package com.trade.service.contract.util.esign.entity;

import java.io.Serializable;

import com.trade.service.contract.dto.ContractSeal;
import com.trade.service.contract.util.esign.ESignConfig;
import com.trade.service.contract.util.esign.ESignConstant;
import org.apache.commons.lang3.StringUtils;


/**
 * @Description:e签宝：个人账户实体类
 * @Author:wanxiangZhou
 * @E-mail:zhouyu@sunxung.cn
 * @Date:Sep 11, 2019 9:13:55 AM
 */
public class ESignOrganAccount implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 机构唯一标识，可传入第三方平台机构id、企业证件号、企业邮箱等如果设置则作为账号唯一性字</br>
     * 段，相同id不可重复创建。（个人用户与机构的唯一标识不可重复）
     */
    private String thirdPartyUserId;
    /**
     * 创建人的个人账号id（调用个人账号创建获取到的accountId）</br>
     * 自2021年11月15日起，此字段调整为非必填，
     * 建议不传此值。
     */
    private String creator;
    /**
     * 机构名称(required)
     */
    private String name;
    /**
     * 证件类型(required)</br>
     * 企业统一社会信用代码-默认CRED_ORG_USCC
     */
    private String idType = "CRED_ORG_USCC";
    /**
     * 证件号，默认为空，发起签署前需确保补齐证件号
     */
    private String idNumber;
    /**
     * 企业法人证件号(身份证号码)
     */
    private String orgLegalIdNumber;
    /**
     * 企业法人名称
     */
    private String orgLegalName;

    public ESignOrganAccount(ContractSeal sealInfo){
        this.thirdPartyUserId = ESignConfig.getOrgThirdPartyUserId(sealInfo.getSealIdNo(), sealInfo.getSealIdType());
        this.name = sealInfo.getSealName();
        this.idType = sealInfo.getSealIdType();
        if (!ESignConstant.CRED_ORG_UNKNOWN.equals(sealInfo.getSealIdType())) {
            this.idNumber = sealInfo.getSealIdNo();// 香港企业不传证件号
        }
        /*if (StringUtils.isNotBlank(sign.getLegalIdNumber())) {
            this.orgLegalIdNumber = sign.getLegalIdNumber();
        }
        if (StringUtils.isNotBlank(sign.getLegalName())) {
            this.orgLegalName = sign.getLegalName();
        }*/
    }

    public String getThirdPartyUserId() {
        return thirdPartyUserId;
    }

    public void setThirdPartyUserId(String thirdPartyUserId) {
        this.thirdPartyUserId = thirdPartyUserId;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdType() {
        return idType;
    }

    public void setIdType(String idType) {
        this.idType = idType;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getOrgLegalIdNumber() {
        return orgLegalIdNumber;
    }

    public void setOrgLegalIdNumber(String orgLegalIdNumber) {
        this.orgLegalIdNumber = orgLegalIdNumber;
    }

    public String getOrgLegalName() {
        return orgLegalName;
    }

    public void setOrgLegalName(String orgLegalName) {
        this.orgLegalName = orgLegalName;
    }
}
