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"`
	TakeProfitRatio       decimal.Decimal `json:"takeProfitRatio" gorm:"type:decimal(10,2);comment:止盈百分比"`
	ReTakeRatio           decimal.Decimal `json:"reTakeRatio" gorm:"type:decimal(10,2);comment:亏损回本止盈百分比"`
	ReduceOrderType       string          `json:"reduceOrderType" gorm:"type:varchar(20);comment:减仓类型 LIMIT-限价 MARKET-市价"`
	ReducePriceRatio      decimal.Decimal `json:"reducePriceRatio" gorm:"type:decimal(10,2);comment:减仓价格百分比"`
	ReduceNumRatio        decimal.Decimal `json:"reduceNumRatio" gorm:"type:decimal(10,2);comment:减仓数量百分比"`
	ReduceTakeProfitRatio decimal.Decimal `json:"reduceTakeProfitRatio" gorm:"type:decimal(10,2);comment:减仓后止盈百分比"`
	ReduceStopLossRatio   decimal.Decimal `json:"reduceStopLossRatio" gorm:"type:decimal(10,2);comment:减仓后止损百分比"`
	AddPositionOrderType  string          `json:"addPositionOrderType" gorm:"type:varchar(20);comment:加仓类型 LIMIT-限价 MARKET-市价"`
	AddPositionPriceRatio decimal.Decimal `json:"addPositionPriceRatio" 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:加仓值"`
	ReduceReTakeRatio     decimal.Decimal `json:"reduceReTakeRatio" gorm:"type:decimal(10,2);comment:减仓后亏损回本止盈百分比"`
	TotalAfterAdding      decimal.Decimal `json:"totalAfterAdding" gorm:"-"`   //加仓后总数
	TotalAfterReducing    decimal.Decimal `json:"totalAfterReducing" gorm:"-"` //减仓后总数
	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
}
