package com.ruoyi.credit.domain;

import java.math.BigDecimal;
import java.util.Date;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.credit.annotation.EncryptedField;

/**
 * 服务周期贷款关联对象 dc_service_period_loan
 * 
 * @author ruoyi
 * @date 2025-12-24
 */
public class ServicePeriodLoan extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 关联ID */
    private Long linkId;

    /** 服务周期ID */
    @Excel(name = "服务周期ID")
    private Long servicePeriodId;

    /** 贷款ID */
    @Excel(name = "贷款ID")
    private Long loanId;

    /** 贷款编号 */
    @Excel(name = "贷款编号")
    private String loanNumber;

    /** 贷款金额(加密) */
    @Excel(name = "贷款金额")
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal loanAmount;

    /** 利率(加密) */
    @Excel(name = "利率")
    @EncryptedField(algorithm = "AES-256-GCM")
    private Double interestRate;

    /** 贷款期限(月) */
    @Excel(name = "贷款期限(月)")
    private Integer loanTermMonths;

    /** 月还款额(加密) */
    @Excel(name = "月还款额")
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal monthlyPayment;

    /** 贷款用途 */
    @Excel(name = "贷款用途")
    private String loanPurpose;

    /** 贷款状态 */
    @Excel(name = "贷款状态")
    private String loanStatus;

    /** 贷款开始日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "贷款开始日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date loanStartDate;

    /** 贷款结束日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "贷款结束日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date loanEndDate;

    /** 银行机构ID */
    @Excel(name = "银行机构ID")
    private Long bankInstitutionId;

    /** 银行机构名称 */
    @Excel(name = "银行机构名称")
    private String bankInstitutionName;

    /** 合同期限匹配度 */
    @Excel(name = "合同期限匹配度")
    private String contractTermMatch;

    /** 审批状态 */
    @Excel(name = "审批状态")
    private String approvalStatus;

    /** 审批时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date approvalTime;

    /** 审批人 */
    @Excel(name = "审批人")
    private String approvedBy;

    /** 提交说明 */
    @Excel(name = "提交说明")
    private String submitComments;

    /** 银行选择时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "银行选择时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date bankSelectedTime;

    /** 银行选择变更历史 */
    @Excel(name = "银行选择变更历史")
    private String bankSelectionHistory;

    /** 是否可一键提交 */
    @Excel(name = "是否可一键提交")
    private Boolean quickSubmitEnabled;

    /** 部门ID */
    @Excel(name = "部门ID")
    private Long deptId;

    // 贷款状态常量
    public static final String STATUS_PENDING = "PENDING";      // 待提交
    public static final String STATUS_SUBMITTED = "SUBMITTED";  // 已提交银行
    public static final String STATUS_APPROVED = "APPROVED";    // 银行已审批
    public static final String STATUS_REJECTED = "REJECTED";    // 银行已拒绝
    public static final String STATUS_DISBURSED = "DISBURSED";  // 已放款
    public static final String STATUS_REPAID = "REPAID";        // 已还款
    public static final String STATUS_ACTIVE = "ACTIVE";
    public static final String STATUS_COMPLETED = "COMPLETED";
    public static final String STATUS_CANCELLED = "CANCELLED";

    // 审批状态常量
    public static final String APPROVAL_PENDING = "PENDING";    // 待提交
    public static final String APPROVAL_SUBMITTED = "SUBMITTED"; // 已提交银行
    public static final String APPROVAL_APPROVED = "APPROVED";  // 银行已通过
    public static final String APPROVAL_REJECTED = "REJECTED";  // 银行已拒绝

    // 合同期限匹配度常量
    public static final String MATCH_PERFECT = "PERFECT";
    public static final String MATCH_GOOD = "GOOD";
    public static final String MATCH_ACCEPTABLE = "ACCEPTABLE";
    public static final String MATCH_POOR = "POOR";

    public void setLinkId(Long linkId) 
    {
        this.linkId = linkId;
    }

    public Long getLinkId() 
    {
        return linkId;
    }

    public void setServicePeriodId(Long servicePeriodId) 
    {
        this.servicePeriodId = servicePeriodId;
    }

    public Long getServicePeriodId() 
    {
        return servicePeriodId;
    }

    public void setLoanId(Long loanId) 
    {
        this.loanId = loanId;
    }

    public Long getLoanId() 
    {
        return loanId;
    }

    public void setLoanNumber(String loanNumber) 
    {
        this.loanNumber = loanNumber;
    }

    public String getLoanNumber() 
    {
        return loanNumber;
    }

    public void setLoanAmount(BigDecimal loanAmount) 
    {
        this.loanAmount = loanAmount;
    }

    public BigDecimal getLoanAmount() 
    {
        return loanAmount;
    }

    public void setInterestRate(Double interestRate) 
    {
        this.interestRate = interestRate;
    }

    public Double getInterestRate() 
    {
        return interestRate;
    }

    public void setLoanTermMonths(Integer loanTermMonths) 
    {
        this.loanTermMonths = loanTermMonths;
    }

    public Integer getLoanTermMonths() 
    {
        return loanTermMonths;
    }

    public void setMonthlyPayment(BigDecimal monthlyPayment) 
    {
        this.monthlyPayment = monthlyPayment;
    }

    public BigDecimal getMonthlyPayment() 
    {
        return monthlyPayment;
    }

    public void setLoanPurpose(String loanPurpose) 
    {
        this.loanPurpose = loanPurpose;
    }

    public String getLoanPurpose() 
    {
        return loanPurpose;
    }

    public void setLoanStatus(String loanStatus) 
    {
        this.loanStatus = loanStatus;
    }

    public String getLoanStatus() 
    {
        return loanStatus;
    }

    public void setLoanStartDate(Date loanStartDate) 
    {
        this.loanStartDate = loanStartDate;
    }

    public Date getLoanStartDate() 
    {
        return loanStartDate;
    }

    public void setLoanEndDate(Date loanEndDate) 
    {
        this.loanEndDate = loanEndDate;
    }

    public Date getLoanEndDate() 
    {
        return loanEndDate;
    }

    public void setBankInstitutionId(Long bankInstitutionId) 
    {
        this.bankInstitutionId = bankInstitutionId;
    }

    public Long getBankInstitutionId() 
    {
        return bankInstitutionId;
    }

    public void setBankInstitutionName(String bankInstitutionName) 
    {
        this.bankInstitutionName = bankInstitutionName;
    }

    public String getBankInstitutionName() 
    {
        return bankInstitutionName;
    }

    public void setContractTermMatch(String contractTermMatch) 
    {
        this.contractTermMatch = contractTermMatch;
    }

    public String getContractTermMatch() 
    {
        return contractTermMatch;
    }

    public void setApprovalStatus(String approvalStatus) 
    {
        this.approvalStatus = approvalStatus;
    }

    public String getApprovalStatus() 
    {
        return approvalStatus;
    }

    public void setApprovalTime(Date approvalTime) 
    {
        this.approvalTime = approvalTime;
    }

    public Date getApprovalTime() 
    {
        return approvalTime;
    }

    public void setApprovedBy(String approvedBy) 
    {
        this.approvedBy = approvedBy;
    }

    public String getApprovedBy() 
    {
        return approvedBy;
    }

    public void setSubmitComments(String submitComments) 
    {
        this.submitComments = submitComments;
    }

    public String getSubmitComments() 
    {
        return submitComments;
    }

    public void setBankSelectedTime(Date bankSelectedTime) 
    {
        this.bankSelectedTime = bankSelectedTime;
    }

    public Date getBankSelectedTime() 
    {
        return bankSelectedTime;
    }

    public void setBankSelectionHistory(String bankSelectionHistory) 
    {
        this.bankSelectionHistory = bankSelectionHistory;
    }

    public String getBankSelectionHistory() 
    {
        return bankSelectionHistory;
    }

    public void setQuickSubmitEnabled(Boolean quickSubmitEnabled) 
    {
        this.quickSubmitEnabled = quickSubmitEnabled;
    }

    public Boolean getQuickSubmitEnabled() 
    {
        return quickSubmitEnabled;
    }

    public void setDeptId(Long deptId) 
    {
        this.deptId = deptId;
    }

    public Long getDeptId() 
    {
        return deptId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("linkId", getLinkId())
            .append("servicePeriodId", getServicePeriodId())
            .append("loanId", getLoanId())
            .append("loanNumber", getLoanNumber())
            .append("loanAmount", getLoanAmount())
            .append("interestRate", getInterestRate())
            .append("loanTermMonths", getLoanTermMonths())
            .append("monthlyPayment", getMonthlyPayment())
            .append("loanPurpose", getLoanPurpose())
            .append("loanStatus", getLoanStatus())
            .append("loanStartDate", getLoanStartDate())
            .append("loanEndDate", getLoanEndDate())
            .append("bankInstitutionId", getBankInstitutionId())
            .append("bankInstitutionName", getBankInstitutionName())
            .append("contractTermMatch", getContractTermMatch())
            .append("approvalStatus", getApprovalStatus())
            .append("approvalTime", getApprovalTime())
            .append("approvedBy", getApprovedBy())
            .append("submitComments", getSubmitComments())
            .append("bankSelectedTime", getBankSelectedTime())
            .append("bankSelectionHistory", getBankSelectionHistory())
            .append("quickSubmitEnabled", getQuickSubmitEnabled())
            .append("deptId", getDeptId())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}