package com.liquidnet.service.goblin.param.shouqianba.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
@ApiModel(value = "创建微信预支付订单请求")
public class CreateWechatPrepayOrderRequest {

    @ApiModelProperty(required = true, value = "应用id", example = "202507xxxxxxx")
    private String appid;

    @ApiModelProperty(required = true, value = "商户信息")
    private CommonRequest.Seller seller;

    @ApiModelProperty(required = true, value = "收单号")
    private String acquiringSn;

    @ApiModelProperty(required = true, value = "收单签名")
    private String signature;

    @ApiModelProperty(required = true, value = "支付工具")
    private List<UsingPayTool> usingPayTools;

    @ApiModelProperty(required = false, value = "支付环境")
    private PaymentEnv paymentEnv;

    @ApiModelProperty(required = true, value = "支付工具签名", notes = "上一步签名")
    private String selectedSignature;

    @ApiModelProperty(required = true, value = "序列号", notes = "上一步seq")
    private String seq;

    @Data
    @ApiModel(value = "支付工具使用详情")
    public static class UsingPayTool {
        @ApiModelProperty(required = true, value = "支付工具ID")
        private Long id;

        @ApiModelProperty(required = true, value = "支付工具代码")
        private Integer payTool;

        @ApiModelProperty(required = true, value = "支付模式", example = "4")
        private Integer payMode;

        @ApiModelProperty(required = true, value = "支付金额")
        private String amount;

        @ApiModelProperty(required = true, value = "金额构成")
        private AmountComposition amountComposition;

        @ApiModelProperty(required = true, value = "用户身份信息", example = "wzwl")
        private String identity;

        @ApiModelProperty(required = true, value = "支付请求号", notes = "不超过40位")
        private String requestSn;

        @ApiModelProperty(required = true, value = "通道扩展参数", example = "{\"sub_appid\":\"wx36e68952a6\"}")
        private Map<String, Object> channelExt;
    }

    @Data
    @ApiModel(value = "支付环境信息")
    public static class PaymentEnv {
        @ApiModelProperty(required = false, value = "付款终端ip")
        private String clientIp;

        @ApiModelProperty(required = false, value = "付款经纬度")
        private ClientPoi clientPoi;

        @ApiModelProperty(required = false, value = "支付入口")
        private String paymentEntry;
    }

    @Data
    @ApiModel(value = "地理位置信息")
    public static class ClientPoi {
        @ApiModelProperty(required = false, value = "经度信息")
        private String longitude;

        @ApiModelProperty(required = false, value = "纬度信息")
        private String latitude;
    }

    @Data
    @ApiModel(value = "金额构成信息")
    public static class AmountComposition {
        @ApiModelProperty(required = true, value = "金额构成项列表")
        private List<CompositionItem> compositionItems;
    }

    @Data
    @ApiModel(value = "金额构成项详情")
    public static class CompositionItem {
        @ApiModelProperty(required = true, value = "构成项类目")
        private String category;

        @ApiModelProperty(required = true, value = "构成项金额")
        private Long amount;
    }
}
