package com.cool.store.vo.close.refund;

import com.cool.store.annotation.DictField;
import com.cool.store.enums.close.RefundPayStatusEnum;
import com.cool.store.enums.master.StoreCloseReasonEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

/**
 * <p>
 * 闭店退款详情VO
 * </p>
 *
 * @author wangff
 * @since 2025/10/13
 */
@Data
public class CloseStoreRefundDetailVO {
    // ===== 单据信息 =====
    @ApiModelProperty("退款单id")
    private Long id;

    @ApiModelProperty("闭店申请id")
    private Long closeStoreId;

    @ApiModelProperty("退款申请单号")
    private String refundNo;

    @ApiModelProperty("退款类型(闭店子阶段code)")
    private Integer type;

    @ApiModelProperty("退款状态")
    private String refundStatus;
    
    @ApiModelProperty("退款状态名称")
    @DictField
    private String refundStatusName;

    @ApiModelProperty("每刻退款单号")
    private String refundOrderNo;

    @ApiModelProperty("退款时间")
    private Date refundTime;

    // ===== 基础信息 =====
    @ApiModelProperty("公司抬头")
    private String invoiceTitle;

    @ApiModelProperty("公司抬头名称")
    @DictField
    private String invoiceTitleName;

    @ApiModelProperty("提交人id")
    private String submitterId;

    @ApiModelProperty("提交人名称")
    private String submitterName;

    // ===== 闭店信息 =====
    @ApiModelProperty("关店原因")
    private Integer closeReason;

    @ApiModelProperty("关店原因名称")
    private String closeReasonName;

    @ApiModelProperty("关店分类名称")
    private String closeNatureName;

    // ===== 退款信息 =====
    @ApiModelProperty("退款事由")
    private String refundReason;

    @ApiModelProperty("退款类型")
    private String refundType;

    @ApiModelProperty("退款类型")
    private String refundTypeName;

    @ApiModelProperty("退款项目")
    private String refundProject;

    @ApiModelProperty("其他说明")
    private String remark;

    @ApiModelProperty("退款加盟商编码")
    private String businessCode;

    @ApiModelProperty("退款加盟商名称")
    private String businessName;

    @ApiModelProperty("退款加盟商收款账户")
    private String businessAccount;

    // ===== 费用信息 =====
    @ApiModelProperty("费用类型code")
    private String expenseTypeCode;

    @ApiModelProperty("费用申请日期")
    private Date expenseApplyTime;

    @ApiModelProperty("应退金额")
    private BigDecimal expectedAmount;

    @ApiModelProperty("实退金额")
    private BigDecimal actualAmount;

    @ApiModelProperty("扣款金额")
    private BigDecimal deductAmount;

    @ApiModelProperty("扣款原因")
    private String deductReason;

    @ApiModelProperty("银行账户")
    private String accountNumber;

    @ApiModelProperty("开户行")
    private String bankName;

    @ApiModelProperty("联行号")
    private String bankBranchNo;

    public String getRefundStatusName() {
        return RefundPayStatusEnum.getDescByStatus(refundStatus);
    }

    public String getCloseNatureName() {
        StoreCloseReasonEnum closeReasonEnum = StoreCloseReasonEnum.getByCode(closeReason);
        return Objects.nonNull(closeReasonEnum) ? closeReasonEnum.getCloseNature().getDesc() : "";
    }

    public String getCloseReasonName() {
        return StoreCloseReasonEnum.getDescByCode(closeReason);
    }
}
