package com.loan.system.domain.entity;

import lombok.*;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.Instant;

@Entity
@Table(name = "loan_case", uniqueConstraints = {
        @UniqueConstraint(name = "case_no", columnNames = {"case_no"})
})
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoanCase extends BaseEntity{
    private static final long serialVersionUID = 17L;

    @Column(name = "case_no", length = 50)
    private String caseNo;

    @Column(name = "customer_id")
    private Long customerId;

    @Column(name = "business_type" , length = 20)
    private String businessType;

    @Column(name = "business_attrs", length = 200)
    private String businessAttrs;

    @Column(name = "channel_name" , length = 20)
    private String channelName;

    @Column(name = "recommender_id")
    private Long recommenderId;

    @Column(name = "requested_amount", precision = 18, scale = 2)
    private BigDecimal requestedAmount;

    @Column(name = "total_loan_amount", precision = 18, scale = 2)
    private BigDecimal totalLoanAmount;

    @Column(name = "is_complete", length = 1)
    private Boolean isComplete;

    @Column(name = "create_time")
    private String createTime;

    @Column(name = "update_time")
    private String updateTime;

    @Column(name = "is_delete")
    private Boolean isDelete;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "customer_id", insertable = false, updatable = false, referencedColumnName = "id")
    private Customer customer;

}