package com.seer.teach.pay.entity;

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 com.seer.teach.common.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 商家收益流水明细表
 * </p>
 *
 * @author ZS
 * @since 2025-09-25
 */
@Getter
@Setter
@ToString
@TableName("pay_merchant_revenue_detail")
public class PayMerchantRevenueDetailEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 结算状态：未结算
     */
    public static final Integer SETTLEMENT_STATUS_UNSETTLED = 0;

    /**
     * 结算状态：已结算
     */
    public static final Integer SETTLEMENT_STATUS_SETTLED = 1;

    /**
     * 商家用户ID
     */
    @TableField("merchant_user_id")
    private Long merchantUserId;

    /**
     * 订单ID
     */
    @TableField("order_id")
    private Integer orderId;

    /**
     * 子订单ID
     */
    @TableField("child_order_id")
    private Integer childOrderId;

    /**
     * 子订单SN
     */
    @TableField("child_order_sn")
    private String childOrderSn;

    /**
     * 商品SKU ID
     */
    @TableField("sku_id")
    private Integer skuId;

    /**
     * 购买用户ID
     */
    @TableField("user_id")
    private Integer userId;

    /**
     * 交易时间
     */
    @TableField("transaction_time")
    private LocalDateTime transactionTime;

    /**
     * 购买数量
     */
    @TableField("quantity")
    private Integer quantity;

    /**
     * 单价(学豆)
     */
    @TableField("unit_price")
    private BigDecimal unitPrice;

    /**
     * 实际收入金额(商品单价*购买数量/兑换比例)
     */
    @TableField("actual_revenue")
    private BigDecimal actualRevenue;

    /**
     * 兑换比例
     */
    @TableField("exchange_ratio")
    private BigDecimal exchangeRatio;

    /**
     * 支付渠道编码
     */
    @TableField("pay_channel_code")
    private String payChannelCode;

    /**
     * 支付订单号
     */
    @TableField("pay_order_sn")
    private String payOrderSn;

    /**
     * 交易状态(PAID:已支付,REFUNDED:已退款)
     */
    @TableField("transaction_status")
    private String transactionStatus;

    /**
     * 结算状态：0-未结算，1-已结算
     */
    @TableField("settlement_status")
    private Integer settlementStatus;

    /**
     * 平台费率(百分比)
     */
    @TableField("platform_fee_rate")
    private BigDecimal platformFeeRate;

    /**
     * 平台手续费
     */
    @TableField("platform_fee")
    private BigDecimal platformFee;

    /**
     * 退款金额
     */
    @TableField("refund_amount")
    private BigDecimal refundAmount;

    /**
     * 退款时间
     */
    @TableField("refund_time")
    private LocalDateTime refundTime;

    /**
     * 提现状态：0-未提现，1-部分提现，2-已提现
     */
    @TableField("withdraw_status")
    private Integer withdrawStatus;
}