/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.guosen.bussinessuserinfo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springblade.common.constant.SystemConstant;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.core.tool.utils.StringUtil;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 实体类
 *
 * @author BladeX
 * @since 2021-10-11
 */
@Data
@TableName("cyzh_bussiness_user_info")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BussinessUserInfo对象", description = "BussinessUserInfo对象")
public class BussinessUserInfo extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	* 用户名称
	*/
	@NotBlank
		@ApiModelProperty(value = "用户名称")
		private String userName;

	/**
	 * 用户简称
	 */
	@ApiModelProperty(value = "用户简称")
	private String userShortName;
	/**
	* 用户证件号
	*/
	@NotBlank
		@ApiModelProperty(value = "用户证件号")
		private String userLicenceNo;
	/**
	 * 用户证件类型
	 */
	@ApiModelProperty(value = "用户证件类型")
	private String userLicenceType;
	/**
	* 用户证件正面照
	*/
		@ApiModelProperty(value = "用户证件正面照")
		private String userCardFrontUrl;
	/**
	* 用户证件反面照
	*/
		@ApiModelProperty(value = "用户证件反面照")
		private String userCardBackUrl;
	/**
	 * 商户实际经营地所在省,要求按照商户实际经营地址选择对应的省编号
	 */
	@ApiModelProperty(value = "商户实际经营地所在省,要求按照商户实际经营地址选择对应的省编号")
	private String province;
	/**
	 * 商户实际经营地所在市,要求按照商户实际经营地址选择对应的市编号
	 */
	@ApiModelProperty(value = "商户实际经营地所在市,要求按照商户实际经营地址选择对应的市编号")
	private String city;
	/**
	 * 商户实际经营地所在区,要求按照商户实际经营地址选择对应的市编号
	 */
	@ApiModelProperty(value = "商户实际经营地所在区,要求按照商户实际经营地址选择对应的市编号")
	private String district;
	/**
	* 用户地址
	*/
		@ApiModelProperty(value = "用户地址")
		private String userAddress;
	/**
	* 用户商户号（小微）
	*/
		@ApiModelProperty(value = "用户商户号（小微）")
		private String merchantNo;
	/**
	* 银行账户类型
	 * DEBIT_CARD(借记卡) PASSBOOK(存折)
	*/
		@ApiModelProperty(value = "银行账户类型")
		private String bankAccountType;
	/**
	* 银行账户号码
	*/
	@NotBlank
		@ApiModelProperty(value = "银行账户号码")
		private String bankCardNo;
	/**
	* 开户总行编码
	*/
		@ApiModelProperty(value = "开户总行编码")
		private String bankCode;
	/**
	* 银行留手机号码
	*/
		@ApiModelProperty(value = "银行留手机号码")
		private String userPhone;
	/**
	* 所属入驻商户
	*/
		@ApiModelProperty(value = "所属入驻商户")
		private Long bussinessId;
	/**
	* 进件状态
	*/
		@ApiModelProperty(value = "进件状态")
		private Integer registerStatus;
	/**
	* 审核意见
	*/
		@ApiModelProperty(value = "审核意见")
		private String auditOpinion;

		@ApiModelProperty(value = "上级商户号")
		private String parentMerchantNo;

	@ApiModelProperty(value = "产品费率策略ID")
	private Long rateStrategyId;

		@TableField(exist = false)
		private String thirdUserCardFrontUrl;

	@TableField(exist = false)
	private String thirdUserCardBackUrl;

	public String toMerchantSubjectInfo(){
		return "{" +
				"\"signName\":" + "\""+ userName + '\"' +
				", \"shortName\":" + "\""+ userShortName + '\"' +
				'}';
	}

	public String toBusinessAddressInfo(){
		return "{" +
				"\"province\":" + "\"" + "440000" + "\"" +
				", \"city\":" + "\"" + "440100" + "\"" +
				", \"district\":" + "\"" + "440106" + "\"" +
				", \"address\":" + "\""+ (StringUtil.isNotBlank(userAddress)? userAddress : "经营地址") + '\"' +
				'}';
	}

	public String toMerchantCorporationInfo(){
		return "{" +
				"\"mobile\"" +":\""+ userPhone + '\"' +
				", \"legalLicenceType\"" +":\""+ userLicenceType + '\"' +
				", \"legalLicenceNo\"" +":\""+ userLicenceNo + '\"' +
				", \"legalLicenceFrontUrl\"" +":\""+ thirdUserCardFrontUrl + '\"' +
				", \"legalLicenceBackUrl\"" +":\""+ thirdUserCardBackUrl + '\"' +
				'}';
	}

	public String toAccountInfo(){
		return "{" +
				"\"bankAccountType\":" + "\""+ bankAccountType + '\"' +
				", \"settlementDirection\":" + "\"" + "ACCOUNT" + "\"" +
				", \"bankCardNo\":" + "\""+ bankCardNo + '\"' +
				", \"bankCode\":" + "\""+ bankCode + '\"' +
				'}';
	}

	public boolean isRegisterSuccess(){
		if(this.registerStatus != null && this.registerStatus.intValue() == SystemConstant.BussinessRegisterStatus.SUCCESS.getValue()){
			return true;
		}else{
			return false;
		}
	}


}
