package com.datacenter.entity.stat;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("stat_copy_trade_position")
public class StatCopyTradePosition {

    @TableId(type = IdType.AUTO)
    private Long id;

    private LocalDateTime statTime;
    private Long traderMemberId;
    private String traderLevel;
    private String symbol;
    private Integer direction;
    private BigDecimal leverageRate;

    /** 持仓量(USDT) */
    private BigDecimal traderPosUsdt;
    /** 带单员未实现盈亏(USDT) */
    private BigDecimal traderUnrealizedPnl;
    /** 收益率% */
    private BigDecimal profitRate;

    /** 普通跟单仓位数量 */
    private Integer normalFollowCount;
    /** 普通跟单仓位金额(USDT) */
    private BigDecimal normalFollowPosUsdt;
    /** 普通跟单未实现盈亏(USDT) */
    private BigDecimal normalFollowPnl;

    /** 无损跟单仓位数量 */
    private Integer specialFollowCount;
    /** 无损跟单仓位金额(USDT) */
    private BigDecimal specialFollowPosUsdt;
    /** 无损跟单未实现盈亏(USDT) */
    private BigDecimal specialFollowPnl;

    private LocalDateTime updatedTime;

    // ── 以下字段仅用于计算，不写入数据库 ──────────────────────────────
    /** 合约类型：0=USDT本位 1=币本位(COIN)，对应 ContractMoneyType */
    @TableField(exist = false)
    private Integer moneyType;
    @TableField(exist = false)
    private BigDecimal shareNumber;
    @TableField(exist = false)
    private BigDecimal traderQty;
    @TableField(exist = false)
    private BigDecimal traderAvgOpen;
    @TableField(exist = false)
    private BigDecimal traderTotalPrincipal;
    @TableField(exist = false)
    private BigDecimal normalFollowQty;
    @TableField(exist = false)
    private BigDecimal normalFollowAvgOpen;
    @TableField(exist = false)
    private BigDecimal specialFollowQty;
    @TableField(exist = false)
    private BigDecimal specialFollowAvgOpen;
}
