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

import com.github.microservice.types.OrderState;
import com.github.microservice.types.deviceUse.DeviceType;
import com.github.microservice.types.payment.PaymentDeviceType;
import com.github.microservice.types.payment.PaymentType;
import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.model.org.orgUser.UserOrgStoreModel;
import com.zhongshu.card.client.model.school.AreaSimpleModel;
import com.zhongshu.card.client.model.school.CardInfoModel;
import com.zhongshu.card.client.model.school.CardInfoSimpleModel;
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/6/17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExpenseFlowPageModel extends SuperModel {
    //-----------------------------订单信息 start---------------------

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

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

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

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

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

    @Schema(description = "支付时间")
    private Long payEndTime;

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

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

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

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

    @Schema(description = "用户在机构的信息和基本信息")
    private UserOrgStoreModel storeUserInfo;

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

    @Schema(description = "设备类型")
    private DeviceType deviceType;

    @Schema(description = "消费地点")
    private AreaSimpleModel area;

    //-----------------------退款 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;

    private String refundUserName;

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

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

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

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


    private String orderTypeStr;

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

    private String paymentTypeStr;

    public String getPaymentTypeStr() {
        if (paymentType != null) {
            return paymentType.getRemark();
        }
        return "";
    }
}
