package com.sunxung.factoring.entity.customerinformation;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sunxung.factoring.entity.BaseEntity;
import com.sunxung.factoring.entity.financing.apply.CFinancingApplicantInfo;
import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractSettlePayment;

import java.util.Objects;

/**
 * @author yaFan
 * 供应商银行卡账户信息表
 */
@TableName("supplier_bank_card_info")
public class SupplierBankCardInfo extends BaseEntity {

    /**
     * 对应分账管理基本信息表Id
     */
    @TableField("ledger_account_basic_info_id")
    private Long ledgerAccountBasicInfoId;

    /**
     * 供应商id
     */
    @TableField("supplier_id")
    private Long supplierId;

    /**
     * 供应商名称
     */
    @TableField("supplier_name")
    private String supplierName;

    /**
     * 所属银行
     */
    @TableField("bank_name")
    private String bankName;
    /**
     * 账户名称
     */
    @TableField("account_name")
    private String accountName;

    /**
     * 账号
     */
    @TableField("account_number")
    private String accountNumber;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SupplierBankCardInfo that = (SupplierBankCardInfo) o;
        return Objects.equals(supplierId, that.supplierId) && Objects.equals(supplierName, that.supplierName) && Objects.equals(bankName, that.bankName) && Objects.equals(accountName, that.accountName) && Objects.equals(accountNumber, that.accountNumber);
    }

    @Override
    public int hashCode() {
        return Objects.hash(supplierId, supplierName, bankName, accountName, accountNumber);
    }

    public SupplierBankCardInfo() {
    }

    public SupplierBankCardInfo(CFinancingApplicantInfo financingApplicantInfo) {
        this.bankName = financingApplicantInfo.getApplicantDesignatedBank();
        this.accountName = financingApplicantInfo.getApplicantDesignatedAccountName();
        this.accountNumber = financingApplicantInfo.getApplicantDesignatedAccount();
    }

    public SupplierBankCardInfo(PurchContractSettlePayment purchContractSettlePayment) {
        this.bankName = purchContractSettlePayment.getBankName();
        this.accountName = purchContractSettlePayment.getBankAccountName();
        this.accountNumber = purchContractSettlePayment.getBankAccount();
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public Long getLedgerAccountBasicInfoId() {
        return ledgerAccountBasicInfoId;
    }

    public void setLedgerAccountBasicInfoId(Long ledgerAccountBasicInfoId) {
        this.ledgerAccountBasicInfoId = ledgerAccountBasicInfoId;
    }
}
