package dto

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

type LineUserProfitLogsGetPageReq struct {
	dto.Pagination `search:"-"`
	UserId         int64  `form:"userId"  search:"type:exact;column:user_id;table:line_user_profit_logs" comment:"line_user 表的id"`
	ApiId          int64  `form:"apiId"  search:"type:exact;column:api_id;table:line_user_profit_logs" comment:"line_apiuser 表的id"`
	PreOrderId     int64  `form:"preOrderId"  search:"type:exact;column:pre_order_id;table:line_user_profit_logs" comment:"line_pre_order 主订单id"`
	Num            string `form:"num"  search:"type:exact;column:num;table:line_user_profit_logs" comment:"成交数量"`
	Symbol         string `form:"symbol"  search:"type:exact;column:symbol;table:line_user_profit_logs" comment:"交易对"`
	LineUserProfitLogsOrder
}

type LineUserProfitLogsOrder struct {
	Id         string `form:"idOrder"  search:"type:order;column:id;table:line_user_profit_logs"`
	UserId     string `form:"userIdOrder"  search:"type:order;column:user_id;table:line_user_profit_logs"`
	ApiId      string `form:"apiIdOrder"  search:"type:order;column:api_id;table:line_user_profit_logs"`
	PreOrderId string `form:"preOrderIdOrder"  search:"type:order;column:pre_order_id;table:line_user_profit_logs"`
	Num        string `form:"numOrder"  search:"type:order;column:num;table:line_user_profit_logs"`
	Symbol     string `form:"symbolOrder"  search:"type:order;column:symbol;table:line_user_profit_logs"`
	Rate       string `form:"rateOrder"  search:"type:order;column:rate;table:line_user_profit_logs"`
	CreatedAt  string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_user_profit_logs"`
	UpdatedAt  string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_user_profit_logs"`
	DeletedAt  string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_user_profit_logs"`
	CreateBy   string `form:"createByOrder"  search:"type:order;column:create_by;table:line_user_profit_logs"`
	UpdateBy   string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_user_profit_logs"`
}

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

type LineUserProfitLogsInsertReq struct {
	Id         int    `json:"-" comment:""` //
	UserId     int64  `json:"userId" comment:"line_user 表的id"`
	ApiId      int64  `json:"apiId" comment:"line_apiuser 表的id"`
	PreOrderId int64  `json:"preOrderId" comment:"line_pre_order 主订单id"`
	Num        string `json:"num" comment:"成交数量"`
	Symbol     string `json:"symbol" comment:"交易对"`
	Rate       string `json:"rate" comment:"盈利比例"`
	Amount     string `json:"amount" comment:"盈利金额（换算成U的价值）"`
	common.ControlBy
}

func (s *LineUserProfitLogsInsertReq) Generate(model *models.LineUserProfitLogs) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.UserId = s.UserId
	model.ApiId = s.ApiId
	model.PreOrderId = s.PreOrderId
	model.Num = s.Num
	model.Symbol = s.Symbol
	model.Rate = s.Rate
	model.Amount = s.Amount
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

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

type LineUserProfitLogsUpdateReq struct {
	Id         int    `uri:"id" comment:""` //
	UserId     int64  `json:"userId" comment:"line_user 表的id"`
	ApiId      int64  `json:"apiId" comment:"line_apiuser 表的id"`
	PreOrderId int64  `json:"preOrderId" comment:"line_pre_order 主订单id"`
	Num        string `json:"num" comment:"成交数量"`
	Symbol     string `json:"symbol" comment:"交易对"`
	Rate       string `json:"rate" comment:"盈利比例"`
	Amoubt     string `json:"" comment:"盈利比例"`
	common.ControlBy
}

func (s *LineUserProfitLogsUpdateReq) Generate(model *models.LineUserProfitLogs) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.UserId = s.UserId
	model.ApiId = s.ApiId
	model.PreOrderId = s.PreOrderId
	model.Num = s.Num
	model.Symbol = s.Symbol
	model.Rate = s.Rate
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

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

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

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

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

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