package org.springblade.yeePay.entity.saas.trade;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;

@Data
@Builder
@ApiModel("申请分账入参")
@NoArgsConstructor
@AllArgsConstructor
public class DivideApplyDto {
	@NotBlank
	@ApiModelProperty(value = "发起方商户编号。与交易下单传入的保持一致", required = true)
	private String parentMerchantNo;

	@NotBlank
	@ApiModelProperty(value = "收款商户编号", required = true)
	private String merchantNo;

	@NotBlank
	@ApiModelProperty(value = "商户请求收款的交易单号", required = true)
	private String orderId;

	@NotBlank
	@ApiModelProperty(value = "收款交易对应在易宝的收款单号", required = true)
	private String uniqueOrderNo;

	@NotBlank
	@ApiModelProperty(value = "商户分账请求号", required = true)
	private String divideRequestId;

	@NotBlank
	@ApiModelProperty(value = "分账明细", required = true)
	private List<DivideDetail> divideDetail;

	@ApiModelProperty(value = "合作银行信息")
	private AccountLinkInformation accountLinkInfo;

	@Data
	@Builder
	@ApiModel("分账明细")
	@NoArgsConstructor
	@AllArgsConstructor
	public static class DivideDetail {
		@NotBlank
		@ApiModelProperty(value = "分账接收方编号(接收分账资金的易宝商编)", required = true)
		private String ledgerNo;

		@NotBlank
		@ApiModelProperty(value = "分账金额", required = true)
		private BigDecimal amount;

		@NotBlank
		@ApiModelProperty(value = "分账说明", required = true)
		private String divideDetailDesc;
	}
}

@Data
@Builder
@ApiModel("合作银行信息")
@NoArgsConstructor
@AllArgsConstructor
class AccountLinkInformation {

	@ApiModelProperty(value = "服务提供者")
	private String serviceProvider;

	@ApiModelProperty(value = "ip地址")
	private BigDecimal ipAddress;

	@ApiModelProperty(value = "类型")
	private String divideType;

	@ApiModelProperty(value = "token")
	private String token;
}
