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

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springblade.yeePay.common.YeepayApiConstant;

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

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@ApiModel("付款-批量下单入参")
public class AccountPayBatchOrderDto {

	@NotBlank
	@ApiModelProperty(value = "交易主体商编", required = true)
	private String merchantNo;

	@NotBlank
	@ApiModelProperty(value = "业务发起方商编", required = true)
	private String parentMerchantNo;

	@NotBlank
	@ApiModelProperty(value = "批次号，由商户自定义生成，需保证唯一", required = true)
	private String batchNo;

	/**
	 * YeepayApiConstant---receiveType
	 * 可选项如下:
	 * REAL_TIME:实时
	 * TWO_HOUR:两小时
	 * NEXT_DAY:次日
	 */
	@NotBlank
	@ApiModelProperty(value = "到账类型", required = true)
	private YeepayApiConstant.receiveType receiveType;

	@NotBlank
	@ApiModelProperty(value = "订单明细", required = true)
	private List<AccountPayBatchOrderDetail> detailList;

	@ApiModelProperty("商户通知地址，不传则不通知")
	private String notifyUrl;

	@ApiModelProperty("扩展信息")
	private ExtInfoDTO extInfoDTO;

}

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@ApiModel("订单明细")
class AccountPayBatchOrderDetail {

	@NotBlank
	@ApiModelProperty(value = "请求号，由商户自定义生成，需保证唯一", required = true)
	private String requestNo;

	@NotBlank
	@ApiModelProperty(value = "收款方银行账号", required = true)
	private String receiverAccountNo;

	@NotBlank
	@ApiModelProperty(value = "收款方开户名", required = true)
	private String receiverAccountName;

	@NotBlank
	@ApiModelProperty(value = "收款方开户行;银行卡所在开户行编号", required = true)
	private String receiverBankCode;

	@NotBlank
	@ApiModelProperty(value = "付款金额;单位：元（RMB）", required = true)
	private String orderAmount;

	@ApiModelProperty(value = "银行附言;展示在收款银行系统中的附言，由数字、字母、汉字组成（能否成功展示依赖银行系统支持）")
	private String comments;

	/**
	 * YeepayApiConstant---bankAccountType
	 * 账户类型
	 * 可选项如下:
	 * DEBIT_CARD:借记卡
	 * CREDIT_CARD:贷记卡
	 * QUASI_CREDIT_CARD:准贷卡
	 * PASSBOOK:存折
	 * UNIT_SETTLE_CARD:单位结算卡
	 * PUBLIC_CARD:对公卡
	 */
	@NotBlank
	@ApiModelProperty(value = "账户类型", required = true)
	private YeepayApiConstant.bankAccountType bankAccountType;

	@ApiModelProperty(value = "支行编码;银行卡所在支行编码")
	private String branchBankCode;

	/**
	 * YeepayApiConstant---feeSide
	 * 手续费承担方(若不传默认付款方)
	 * 可选项如下:
	 * PAYER:付款方
	 * PAYEE:收款方
	 * 示例值：当商户计费方式为预付实扣或后收时，不支持收款方承担; 当平台商或服务商承担时无需指定此手续费承担方;
	 */
	@NotBlank
	@ApiModelProperty(value = "手续费承担方(若不传默认付款方)", required = true)
	private YeepayApiConstant.feeSide feeChargeSide;

	@ApiModelProperty(value = "备注")
	private String remark;

}

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@ApiModel("扩展信息")
class ExtInfoDTO {

	/**
	 * YeepayApiConstant---terminalType
	 * 终端类型
	 * 可选项如下:
	 * PC:电脑
	 * PHONE:手机
	 * PAD:平板
	 * NFC:可穿戴设备
	 * DTV:数字电视
	 * MPOS:条码支付受理终端
	 * OTHER:其他
	 */
	@ApiModelProperty("终端类型")
	private YeepayApiConstant.terminalType terminalType;
}
