package com.tmerclub.cloud.supplier.mongo;

import com.tmerclub.cloud.api.payment.constant.PaySysType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * 对应MongoDB存储供应商钱包日志emp
 * @author 菠萝凤梨
 */
@CompoundIndexes({
        @CompoundIndex(name = "supplierId_reason_idx", def = "{'supplierId':1, 'reason':1}"),
        @CompoundIndex(name = "order_idx", def = "{'orderId':1}")
})
@Document("supplier_wallet_log")
@Data
public class MongoSupplierWalletLogBO {

    @Id
    @Schema(description = "供应商钱包id")
    private Long walletLogId;

    @Schema(description = "供应商id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long supplierId;

    /**
     * 支付系统类型
     * @see PaySysType
     */
    @Schema(description = "支付系统类型", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer paySysType;

    @Schema(description = "关联订单id")
    private Long orderId;

    @Schema(description = "关联退款单id")
    private Long refundId;

    @Schema(description = "收支类型 0支出 1收入")
    private Integer ioType;

    @Schema(description = "金额类型 0 未结算金额 1可提现金额  2冻结金额")
    private Integer amountType;

    @Schema(description = "改变金额")
    private Long changeAmount;

    @Schema(description = "原因 0用户支付 1用户确认收货 2 用户退款申请 3 拒绝用户退款申请 4 提现申请 5 提现申请被拒绝")
    private Integer reason;

    @Schema(description = "用户金额（支付实付金额，退款实际申请金额）")
    private Long userAmount;

    @Schema(description = "平台补贴金额")
    private Long platformAmount;

    @Schema(description = "分销占用金额")
    private Long distributionAmount;

    @Schema(description = "平台佣金")
    private Long platformCommission;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private Date createTime;

    @Schema(description = "更新时间")
    private Date updateTime;

    //----mongodb没有的字段-----

    @Schema(description = "运费")
    private Long freightAmount;

    @Schema(description = "供应商名称")
    private String supplierName;

}
