package com.zhongshu.card.server.core.domain.payment;

import com.github.microservice.pay.client.model.ledger.TransactionLogModel;
import com.github.microservice.types.payment.PaymentType;
import com.zhongshu.card.client.type.RefundState;
import com.zhongshu.card.client.type.payment.RefundMethodType;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.common.aliasing.qual.NonLeaked;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 订单退款记录
 *
 * @author TRX
 * @date 2024/11/19
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class RefundRecord extends SuperMain {

    @Indexed
    @Schema(description = "支付订单号")
    private String paymentNo;

    @Indexed
    @Schema(description = "退款订单号")
    private String refundNo;

    @Schema(description = "退款状态")
    private RefundState refundState;

    @Schema(description = "支付方式")
    private PaymentType paymentType;

    @Schema(description = "退款方式")
    private RefundMethodType refundMethodType = RefundMethodType.BusRefund;

    //--------------申请人 start---------------------
    @Schema(description = "退款申请人userId")
    private String applicant;

    @Schema(description = "退款金额")
    private BigDecimal refundAMount;

    @Schema(description = "申请退款时间")
    private Long refundTime;

    @Schema(description = "申请退款备注")
    private String refundRemark;

    //-------------------审核 start--------------------

    @Schema(description = "操作退款用户userId（审核人）")
    private String refundUserId;

    @Schema(description = "审核时间")
    private Long examineTime;

    @Schema(description = "退款处理备注")
    private String refuseRemark;

    @Schema(description = "退款账单流量")
    private List<TransactionLogModel> refundTransactionIds = new ArrayList<TransactionLogModel>();

}
