package com.yc.ship.module.trade.api.dto;

import cn.hutool.json.JSONObject;
import com.yc.ship.framework.common.validation.IntEnum;
import com.yc.ship.module.trade.enums.PaySourceEnum;
import com.yc.ship.module.trade.enums.PayTypeEnum;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * &#064;Description ：支付请求VO
 * &#064;Author ：qsl
 * &#064;Date ：2025/6/22 15:04
 */
@Schema(description = "支付请求VO")
@Data
public class PayOrderReqDTO {

    @Schema(description = "订单ID", example = "222")
    @NotNull(message = "订单ID不能为空")
    private Long orderId;

    @IntEnum(value = PayTypeEnum.class,message = "支付方式不正确")
    @NotNull(message = "支付方式不能为空")
    private Integer payType;

    @Schema(description = "支付方式额外类型，微信、支付宝时，指出0主扫 1被扫，可不传", example = "")
    private Integer payExtraType;

    @Schema(description = "支付金额", example = "100")
    @NotNull(message = "支付金额不能为空")
    private BigDecimal payAmount;

    @Schema(description = "付款人ID", example = "旅行社ID、分销商ID、会员ID")
    @Hidden
    private String accountId;

    @Schema(description = "账号类型", example = "旅行社、分销商、会员")
    @Hidden
    private Integer accountType;
    @Schema(description = "账号名称", example = "xxx旅行社、xxx门店、xxx分销商、会员名称")
    @Hidden
    private String accountName;

    @Schema(description = "微信或支付宝平台的用户openId", example = "")
    private String openId;

    @Schema(description = "前台支付传入的参数", example = "")
    private PayParams payParams;

    @IntEnum(value = PaySourceEnum.class,message = "支付来源不正确")
    @Schema(description = "支付来源，外部订单支付必传", example = "")
    private Integer paySource;

    @Schema(description = "是否可以换支付方式 0否 1是，默认是，主要用于授信、预付款切换", example = "")
    private Integer canChangePayType;

    @Data
    public static class PayParams{
        @Schema(description = "银联参数", example = "")
        private String msgType;
        @Schema(description = "银联参数", example = "")
        private String channelType;
        @Schema(description = "银联参数", example = "")
        private String payReturnUrl;
        @Schema(description = "银联参数", example = "")
        private String payCode;
        @Schema(description = "银联参数", example = "")
        private String tradeChannel;
        @Schema(description = "银联参数", example = "")
        private String tranCode;
        @Schema(description = "银联参数", example = "")
        private String appId;
        @Schema(description = "银联参数", example = "")
        private String productId;
        @Schema(description = "银联参数", example = "")
        private String body;
        @Schema(description = "银联参数", example = "")
        private String subject;
        @Schema(description = "银联参数", example = "")
        private String param;
        @Schema(description = "扩展信息", example = "")
        private JSONObject extra;
        @Schema(description = "", example = "")
        private String clientIp;
        @Schema(description = "", example = "")
        private String device;
    }

}
