package dto

import (
	"go-admin/app/admin/models"
	"go-admin/common/dto"
	common "go-admin/common/models"

	"github.com/shopspring/decimal"
)

type LineCoinnetworkGetPageReq struct {
	dto.Pagination `search:"-"`
	LineCoinnetworkOrder
}

type LineCoinnetworkOrder struct {
	Id          string `form:"idOrder"  search:"type:order;column:id;table:line_coinnetwork"`
	NetworkName string `form:"networkNameOrder"  search:"type:order;column:network_name;table:line_coinnetwork"`
	TokenName   string `form:"tokenNameOrder"  search:"type:order;column:token_name;table:line_coinnetwork"`
	ArrivalNum  string `form:"arrivalNumOrder"  search:"type:order;column:arrival_num;table:line_coinnetwork"`
	UnlockNum   string `form:"unlockNumOrder"  search:"type:order;column:unlock_num;table:line_coinnetwork"`
	UnlockTime  string `form:"unlockTimeOrder"  search:"type:order;column:unlock_time;table:line_coinnetwork"`
	Fee         string `form:"feeOrder"  search:"type:order;column:fee;table:line_coinnetwork"`
	CreateBy    string `form:"createByOrder"  search:"type:order;column:create_by;table:line_coinnetwork"`
	UpdateBy    string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_coinnetwork"`
	CreatedAt   string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_coinnetwork"`
	UpdatedAt   string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_coinnetwork"`
	DeletedAt   string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_coinnetwork"`
}

func (m *LineCoinnetworkGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type LineCoinnetworkAppResp struct {
	Id            int             `json:"id"`
	NetworkName   string          `json:"networkName"`
	MinWithdrawal decimal.Decimal `json:"minWithdrawal"`
	Fee           decimal.Decimal `json:"fee"`
}

type LineCoinnetworkInsertReq struct {
	Id            int             `json:"-" comment:"主键ID"` // 主键ID
	NetworkName   string          `json:"networkName" comment:"网络名称"`
	TokenName     string          `json:"tokenName" comment:"网络token名称"`
	ArrivalNum    int64           `json:"arrivalNum" comment:"充值区块确认数"`
	UnlockNum     int64           `json:"unlockNum" comment:"提现解锁确认数"`
	UnlockTime    int64           `json:"unlockTime" comment:"提现确认平均时间，单位分钟"`
	Fee           decimal.Decimal `json:"fee" comment:"网络手续费百分比"`
	MinWithdrawal decimal.Decimal `json:"minWithdrawal" comment:"最小提现金额"`
	Status        int             `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *LineCoinnetworkInsertReq) Generate(model *models.LineCoinnetwork) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.NetworkName = s.NetworkName
	model.TokenName = s.TokenName
	model.ArrivalNum = s.ArrivalNum
	model.UnlockNum = s.UnlockNum
	model.UnlockTime = s.UnlockTime
	model.Fee = s.Fee
	model.MinWithdrawal = s.MinWithdrawal
	model.Status = s.Status
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *LineCoinnetworkInsertReq) GetId() interface{} {
	return s.Id
}

type LineCoinnetworkUpdateReq struct {
	Id            int             `uri:"id" comment:"主键ID"` // 主键ID
	NetworkName   string          `json:"networkName" comment:"网络名称"`
	TokenName     string          `json:"tokenName" comment:"网络token名称"`
	ArrivalNum    int64           `json:"arrivalNum" comment:"充值区块确认数"`
	UnlockNum     int64           `json:"unlockNum" comment:"提现解锁确认数"`
	UnlockTime    int64           `json:"unlockTime" comment:"提现确认平均时间，单位分钟"`
	Fee           decimal.Decimal `json:"fee" comment:"网络手续费百分比"`
	MinWithdrawal decimal.Decimal `json:"minWithdrawal" comment:"最小提现金额"`
	Status        int             `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *LineCoinnetworkUpdateReq) Generate(model *models.LineCoinnetwork) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.NetworkName = s.NetworkName
	model.TokenName = s.TokenName
	model.ArrivalNum = s.ArrivalNum
	model.UnlockNum = s.UnlockNum
	model.UnlockTime = s.UnlockTime
	model.Fee = s.Fee
	model.MinWithdrawal = s.MinWithdrawal
	model.Status = s.Status
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *LineCoinnetworkUpdateReq) GetId() interface{} {
	return s.Id
}

// LineCoinnetworkGetReq 功能获取请求参数
type LineCoinnetworkGetReq struct {
	Id int `uri:"id"`
}

func (s *LineCoinnetworkGetReq) GetId() interface{} {
	return s.Id
}

// LineCoinnetworkDeleteReq 功能删除请求参数
type LineCoinnetworkDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *LineCoinnetworkDeleteReq) GetId() interface{} {
	return s.Ids
}
