package models

import (
	"go-admin/common/models"

	"github.com/shopspring/decimal"
)

type LinePreOrderExt struct {
	models.Model

	MainOrderId        int             `json:"mainOrderId" gorm:"type:bigint;comment:主单id"`
	OrderId            int             `json:"orderId" gorm:"type:bigint;comment:订单id"`
	AddType            int             `json:"addType" gorm:"type:tinyint;comment:类型 1-加仓 2-减仓"`
	ExpirateHour       int             `json:"expirateHour" gorm:"type:int;comment:过期时间(0=永久有效)"`
	OrderType          string          `json:"orderType" gorm:"type:varchar(20);comment:订单类型 LIMIT-限价 MARKET-市价"`
	PriceRatio         decimal.Decimal `json:"priceRatio" gorm:"type:decimal(10,2);comment: (加仓/减仓)触发价格百分比"`
	AddPositionType    int             `json:"addPositionType" gorm:"type:int;comment:(加仓/减仓)类型 1-百分比 2-实际金额"`
	AddPositionVal     decimal.Decimal `json:"addPositionVal" gorm:"type:decimal(10,2);comment:加仓值"`
	TakeProfitRatio    decimal.Decimal `json:"takeProfitRatio" gorm:"type:decimal(10,2);comment:止盈百分比"`
	StopLossRatio      decimal.Decimal `json:"stopLossRatio" gorm:"type:decimal(10,2);comment:止损百分比"`
	TakeProfitNumRatio decimal.Decimal `json:"takeProfitNumRatio" gorm:"type:decimal(10,2);comment:止盈数量百分比"`
	TpTpPriceRatio     decimal.Decimal `json:"tpTpPriceRatio" gorm:"type:decimal(10,2);comment:止盈后止盈百分比"`
	TpSlPriceRatio     decimal.Decimal `json:"tpSlPriceRatio" gorm:"type:decimal(10,2);comment:止盈后止损百分比"`
	ReTakeRatio        decimal.Decimal `json:"reTakeRatio" gorm:"type:decimal(10,2);comment:亏损回本止盈百分比"`
	TotalBefore        decimal.Decimal `gorm:"-" comment:"初始总数"`
	TotalAfter         decimal.Decimal `gorm:"-" comment:"剩余总数"`
	models.ModelTime
	models.ControlBy
}

func (LinePreOrderExt) TableName() string {
	return "line_pre_order_ext"
}

func (e *LinePreOrderExt) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *LinePreOrderExt) GetId() interface{} {
	return e.Id
}
