package dto

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

type LineSymbolPriceGetPageReq struct {
	dto.Pagination `search:"-"`
	Symbol         string `form:"symbol"  search:"type:exact;column:symbol;table:line_symbol_price" comment:"交易对"`
	Status         int    `form:"status"  search:"type:exact;column:status;table:line_symbol_price" comment:"状态 1-启用 2-禁用"`
	LineSymbolPriceOrder
}

type LineSymbolPriceOrder struct {
	Id        string `form:"idOrder"  search:"type:order;column:id;table:line_symbol_price"`
	Symbol    string `form:"symbolOrder"  search:"type:order;column:symbol;table:line_symbol_price"`
	Status    string `form:"statusOrder"  search:"type:order;column:status;table:line_symbol_price"`
	CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_symbol_price"`
	UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_symbol_price"`
	DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_symbol_price"`
	CreateBy  string `form:"createByOrder"  search:"type:order;column:create_by;table:line_symbol_price"`
	UpdateBy  string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_symbol_price"`
}

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

type LineSymbolPriceInsertReq struct {
	Id     int    `json:"-" comment:"主键id"` // 主键id
	Symbol string `json:"symbol" comment:"交易对"`
	Status int    `json:"status" comment:"状态 1-启用 2-禁用"`
	common.ControlBy
}

func (s *LineSymbolPriceInsertReq) Generate(model *models.LineSymbolPrice) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Symbol = strings.ToUpper(s.Symbol)
	model.Status = s.Status
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

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

type LineSymbolPriceUpdateReq struct {
	Id     int    `uri:"id" comment:"主键id"` // 主键id
	Symbol string `json:"symbol" comment:"交易对"`
	Status int    `json:"status" comment:"状态 1-启用 2-禁用"`
	common.ControlBy
}

func (s *LineSymbolPriceUpdateReq) Generate(model *models.LineSymbolPrice) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Symbol = strings.ToUpper(s.Symbol)
	model.Status = s.Status
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

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

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

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

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

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