package dto

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

type LineWalletGetPageReq struct {
	dto.Pagination `search:"-"`
	LineWalletOrder
}

type LineWalletOrder struct {
	Id            string `form:"idOrder"  search:"type:order;column:id;table:line_wallet"`
	UserId        string `form:"userIdOrder"  search:"type:order;column:user_id;table:line_wallet"`
	CoinId        string `form:"coinIdOrder"  search:"type:order;column:coin_id;table:line_wallet"`
	CoinCode      string `form:"coinCode"  search:"type:order;column:coin_code;table:line_wallet"`
	Tag           string `form:"tagOrder"  search:"type:order;column:tag;table:line_wallet"`
	Address       string `form:"addressOrder"  search:"type:order;column:address;table:line_wallet"`
	CreateBy      string `form:"createByOrder"  search:"type:order;column:create_by;table:line_wallet"`
	UpdateBy      string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_wallet"`
	CreatedAt     string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_wallet"`
	UpdatedAt     string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_wallet"`
	CoinNetworkId int    `form:"coinNetworkIdOrder"  search:"type:order;column:coin_network_id;table:line_wallet"`
}

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

type LineWalletInsertReq struct {
	Id            int    `json:"-" comment:"主键ID"` // 主键ID
	UserId        int64  `json:"userId" comment:"用户Id"`
	CoinId        int64  `json:"coinId" comment:"币种id"`
	CoinCode      string `json:"coinCode" comment:"币种名称"`
	Tag           string `json:"tag" comment:"标签"`
	Address       string `json:"address" comment:"地址"`
	CoinNetworkId int    `json:"coinNetworkId" comment:"币种主网id，useri+主网id做唯一"`
	common.ControlBy
}

func (s *LineWalletInsertReq) Generate(model *models.LineWallet) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.UserId = s.UserId
	model.CoinId = s.CoinId
	model.Tag = s.Tag
	model.CoinCode = s.CoinCode
	model.Address = s.Address
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
	model.CoinNetworkId = s.CoinNetworkId
}

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

type LineWalletUpdateReq struct {
	Id            int    `uri:"id" comment:"主键ID"` // 主键ID
	UserId        int64  `json:"userId" comment:"用户Id"`
	CoinId        int64  `json:"coinId" comment:"币种id"`
	CoinCode      string `json:"coinCode" comment:"币种名称"`
	Tag           string `json:"tag" comment:"标签"`
	Address       string `json:"address" comment:"地址"`
	CoinNetworkId int    `json:"coinNetworkId" comment:"币种主网id，useri+主网id做唯一"`
	common.ControlBy
}

func (s *LineWalletUpdateReq) Generate(model *models.LineWallet) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.UserId = s.UserId
	model.CoinId = s.CoinId
	model.Tag = s.Tag
	model.CoinCode = s.CoinCode
	model.Address = s.Address
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
	model.CoinNetworkId = s.CoinNetworkId
}

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

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

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

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

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