package dto

import (
    "time"

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

type LineRechargeGetPageReq struct {
	dto.Pagination     `search:"-"`
    LineRechargeOrder
}

type LineRechargeOrder struct {
    Id string `form:"idOrder"  search:"type:order;column:id;table:line_recharge"`
    CoinId string `form:"coinIdOrder"  search:"type:order;column:coin_id;table:line_recharge"`
    UserId string `form:"userIdOrder"  search:"type:order;column:user_id;table:line_recharge"`
    Confirms string `form:"confirmsOrder"  search:"type:order;column:confirms;table:line_recharge"`
    TranType string `form:"tranTypeOrder"  search:"type:order;column:tran_type;table:line_recharge"`
    BlockIndex string `form:"blockIndexOrder"  search:"type:order;column:block_index;table:line_recharge"`
    Amount string `form:"amountOrder"  search:"type:order;column:amount;table:line_recharge"`
    Account string `form:"accountOrder"  search:"type:order;column:account;table:line_recharge"`
    Address string `form:"addressOrder"  search:"type:order;column:address;table:line_recharge"`
    Txid string `form:"txidOrder"  search:"type:order;column:txid;table:line_recharge"`
    BlockTime string `form:"blockTimeOrder"  search:"type:order;column:block_time;table:line_recharge"`
    TimeReceived string `form:"timeReceivedOrder"  search:"type:order;column:time_received;table:line_recharge"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:line_recharge"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_recharge"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_recharge"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_recharge"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_recharge"`
    MainCoin string `form:"mainCoinOrder"  search:"type:order;column:main_coin;table:line_recharge"`
    OrderNo string `form:"orderNoOrder"  search:"type:order;column:order_no;table:line_recharge"`
    Status string `form:"statusOrder"  search:"type:order;column:status;table:line_recharge"`
    State string `form:"stateOrder"  search:"type:order;column:state;table:line_recharge"`
    Fee string `form:"feeOrder"  search:"type:order;column:fee;table:line_recharge"`
    AddressFrom string `form:"addressFromOrder"  search:"type:order;column:address_from;table:line_recharge"`
    
}

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

type LineRechargeInsertReq struct {
    Id int `json:"-" comment:"主键"` // 主键
    CoinId int64 `json:"coinId" comment:"币种id"`
    UserId int64 `json:"userId" comment:"用户Id"`
    Confirms string `json:"confirms" comment:"区块确认数"`
    TranType string `json:"tranType" comment:"类型：1线上，2内部"`
    BlockIndex string `json:"blockIndex" comment:"区块高度"`
    Amount string `json:"amount" comment:"数量"`
    Account string `json:"account" comment:"账户"`
    Address string `json:"address" comment:"地址"`
    Txid string `json:"txid" comment:"交易id"`
    BlockTime time.Time `json:"blockTime" comment:"同步时间"`
    TimeReceived time.Time `json:"timeReceived" comment:"确认时间"`
    MainCoin string `json:"mainCoin" comment:"充值网络"`
    OrderNo string `json:"orderNo" comment:"订单号"`
    Status string `json:"status" comment:"状态1==进行中暂时保留，2==成功，3==失败"`
    State string `json:"state" comment:"来源状态 0 待審核 1 審核成功 2 審核駁回 3交易成功 4交易失敗"`
    Fee string `json:"fee" comment:"手续费"`
    AddressFrom string `json:"addressFrom" comment:"来源地址"`
    common.ControlBy
}

func (s *LineRechargeInsertReq) Generate(model *models.LineRecharge)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.CoinId = s.CoinId
    model.UserId = s.UserId
    model.Confirms = s.Confirms
    model.TranType = s.TranType
    model.BlockIndex = s.BlockIndex
    model.Amount = s.Amount
    model.Account = s.Account
    model.Address = s.Address
    model.Txid = s.Txid
    model.BlockTime = s.BlockTime
    model.TimeReceived = s.TimeReceived
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
    model.MainCoin = s.MainCoin
    model.OrderNo = s.OrderNo
    model.Status = s.Status
    model.State = s.State
    model.Fee = s.Fee
    model.AddressFrom = s.AddressFrom
}

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

type LineRechargeUpdateReq struct {
    Id int `uri:"id" comment:"主键"` // 主键
    CoinId int64 `json:"coinId" comment:"币种id"`
    UserId int64 `json:"userId" comment:"用户Id"`
    Confirms string `json:"confirms" comment:"区块确认数"`
    TranType string `json:"tranType" comment:"类型：1线上，2内部"`
    BlockIndex string `json:"blockIndex" comment:"区块高度"`
    Amount string `json:"amount" comment:"数量"`
    Account string `json:"account" comment:"账户"`
    Address string `json:"address" comment:"地址"`
    Txid string `json:"txid" comment:"交易id"`
    BlockTime time.Time `json:"blockTime" comment:"同步时间"`
    TimeReceived time.Time `json:"timeReceived" comment:"确认时间"`
    MainCoin string `json:"mainCoin" comment:"充值网络"`
    OrderNo string `json:"orderNo" comment:"订单号"`
    Status string `json:"status" comment:"状态1==进行中暂时保留，2==成功，3==失败"`
    State string `json:"state" comment:"来源状态 0 待審核 1 審核成功 2 審核駁回 3交易成功 4交易失敗"`
    Fee string `json:"fee" comment:"手续费"`
    AddressFrom string `json:"addressFrom" comment:"来源地址"`
    common.ControlBy
}

func (s *LineRechargeUpdateReq) Generate(model *models.LineRecharge)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.CoinId = s.CoinId
    model.UserId = s.UserId
    model.Confirms = s.Confirms
    model.TranType = s.TranType
    model.BlockIndex = s.BlockIndex
    model.Amount = s.Amount
    model.Account = s.Account
    model.Address = s.Address
    model.Txid = s.Txid
    model.BlockTime = s.BlockTime
    model.TimeReceived = s.TimeReceived
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
    model.MainCoin = s.MainCoin
    model.OrderNo = s.OrderNo
    model.Status = s.Status
    model.State = s.State
    model.Fee = s.Fee
    model.AddressFrom = s.AddressFrom
}

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

// LineRechargeGetReq 功能获取请求参数
type LineRechargeGetReq struct {
     Id int `uri:"id"`
}
func (s *LineRechargeGetReq) GetId() interface{} {
	return s.Id
}

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

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