package com.hfkj.openapi.v1.model.request;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 请求分账
 * @className: RequestSeparateModel
 * @author: HuRui
 * @date: 2023/5/26
 **/
@Data
public class RequestSeparateModel {

    /**
     * 商户号
     */
    @NotBlank(message = "商户号必填项")
    private String merchantNo;

    /**
     * 商户交易单号
     */
    @Length(min = 6, max = 50, message = "商户交易单号长度限制6至50位字符串长度")
    @NotBlank(message = "商户交易单号必填项")
    private String outTradeNo;

    /**
     * 分账流水号
     */
    @NotBlank(message = "分账流水号必填项")
    @Length(min = 6, max = 50, message = "分账流水号限制6至50位字符串长度")
    private String outSeparateNo;

    /**
     * 分账总金额
     */
    @NotBlank(message = "分账总金额必填项")
    @DecimalMin(value = "0.01", message = "分账总金额最小0.01")
    @DecimalMax(value = "9999999", message = "分账总金额最大9999999")
    private String totalAmount;

    /**
     * 分账接收方
     */
    @NotNull(message = "分账接收方必填项")
    @Valid
    private List<RequestSeparateRecvDataModel> recvDatas;

    /**
     * 签名参数
     */
    @NotBlank(message = "签名必填项")
    private String sign;


    @Data
    public static class RequestSeparateRecvDataModel {
        @NotBlank(message = "分账接收方商户号必填项")
        private String recvMerchantNo;


        @NotBlank(message = "分账接收方金额必填项")
        @DecimalMin(value = "0.01", message = "分账总金额最小0.01")
        @DecimalMax(value = "9999999", message = "分账总金额最大9999999")
        private String separateAmount;

    }
}
