package dto

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

type LinePreOrderStatusGetPageReq struct {
	dto.Pagination `search:"-"`
	LinePreOrderStatusOrder
}

type LinePreOrderStatusOrder struct {
	Id                string `form:"idOrder"  search:"type:order;column:id;table:line_pre_order_status"`
	OrderId           string `form:"orderIdOrder"  search:"type:order;column:order_id;table:line_pre_order_status"`
	OrderSn           string `form:"orderSnOrder"  search:"type:order;column:order_sn;table:line_pre_order_status"`
	AddPositionStatus string `form:"addPositionStatusOrder"  search:"type:order;column:add_position_status;table:line_pre_order_status"`
	HedgeStatus       string `form:"hedgeStatusOrder"  search:"type:order;column:hedge_status;table:line_pre_order_status"`
	CreatedAt         string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_pre_order_status"`
	UpdatedAt         string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_pre_order_status"`
	DeletedAt         string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_pre_order_status"`
	CreateBy          string `form:"createByOrder"  search:"type:order;column:create_by;table:line_pre_order_status"`
	UpdateBy          string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_pre_order_status"`
}

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

type LinePreOrderStatusInsertReq struct {
	Id                int    `json:"-" comment:"主键"` // 主键
	OrderId           int    `json:"orderId" comment:"主订单id"`
	OrderSn           string `json:"orderSn" comment:"主订单号"`
	AddPositionStatus int    `json:"addPositionStatus" comment:"加仓状态 0-无 1-已加仓"`
	HedgeStatus       int    `json:"hedgeStatus" comment:"对冲状态 0-无 1-已对冲"`
	common.ControlBy
}

func (s *LinePreOrderStatusInsertReq) Generate(model *models.LinePreOrderStatus) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.OrderId = s.OrderId
	model.OrderSn = s.OrderSn
	model.AddPositionStatus = s.AddPositionStatus
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

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

type LinePreOrderStatusUpdateReq struct {
	Id                int    `uri:"id" comment:"主键"` // 主键
	OrderId           int    `json:"orderId" comment:"主订单id"`
	OrderSn           string `json:"orderSn" comment:"主订单号"`
	AddPositionStatus int    `json:"addPositionStatus" comment:"加仓状态 0-无 1-已加仓"`
	HedgeStatus       int    `json:"hedgeStatus" comment:"对冲状态 0-无 1-已对冲"`
	common.ControlBy
}

func (s *LinePreOrderStatusUpdateReq) Generate(model *models.LinePreOrderStatus) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.OrderId = s.OrderId
	model.OrderSn = s.OrderSn
	model.AddPositionStatus = s.AddPositionStatus
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

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

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

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

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

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