package com.zhongshu.card.client.openApi.model;

import com.github.microservice.types.OrderState;
import com.github.microservice.types.payment.PaymentDeviceType;
import com.zhongshu.card.client.model.school.CardInfoModel;
import com.zhongshu.card.client.openApi.base.SuperAPIModel;
import com.zhongshu.card.client.type.RefundState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @author TRX
 * @date 2024/11/12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExpenseFlowOpenApiModel extends SuperAPIModel {
    //-----------------------------订单信息 start---------------------

    @Schema(description = "订单的总体状态")
    private OrderState orderType;

    private String orderTypeStr;

    public String getOrderTypeStr() {
        if (orderType != null) {
            return orderType.getRemark();
        }
        return "";
    }

    @Schema(description = "用户userId")
    private String userId;

    @Schema(description = "用户名称")
    private String userName;

    @Schema(description = "消费机设备ID")
    private String deviceId;

    @Schema(description = "所属项目的code")
    private String projectCode;

    @Schema(description = "订单所属的商户")
    private String shopOid;

    @Schema(description = "订单所属的学校")
    private String schoolOid;

    @Schema(description = "卡片的编号,也是终端刷卡的 卡号")
    private String cardNo;

    @Schema(description = "卡片信息")
    private CardInfoModel cardInfo;

    @Schema(description = "消费类型，如：餐饮消费")
    private String payType;

    @Schema(description = "年份，如: 2024")
    private Integer year;

    @Schema(description = "月份，如: 6")
    private Integer month;

    @Schema(description = "消费订单号")
    private String orderNo;

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

    @Schema(description = "消费创建时间")
    private String paymentTime;

    @Schema(description = "支付方式")
    private String paymentWay;

    @Schema(description = "消费金额（单位：分）")
    private BigDecimal payAmount;

    @Schema(description = "订单是否创建成功")
    private Boolean isCreateSuccess = Boolean.TRUE;

    @Schema(description = "终端支付设备和方式")
    private PaymentDeviceType paymentDeviceType;

    @Schema(description = "消费地点")
    private String placeName;

    //------------------支付结果 start-------------------------

    @Schema(description = "支付订单状态")
    private String paymentStatus;

    @Schema(description = "支付是否成功")
    private Boolean isPaySuccess;

    @Schema(description = "支付结果备注")
    private String payRemark;

    //-----------------------退款 start--------------------------
    @Schema(description = "是否退款")
    private Boolean isRefund;

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

    private String refundStateStr;

    public String getRefundStateStr() {
        if (refundState != null) {
            return refundState.getRemark();
        }
        return "";
    }

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

    @Schema(description = "操作退款用户userId")
    private String refundUserId;

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

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

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

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