package com.loan.system.domain.entity;

import lombok.*;

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

@Entity
@Table(name = "repayment", indexes = {
        @Index(name = "idx_case_id", columnList = "case_id"),
        @Index(name = "idx_repay_at", columnList = "repay_at"),
        @Index(name = "idx_is_cleared", columnList = "is_cleared")
})
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Repayment extends BaseEntity{
    private static final long serialVersionUID = 18L;

    @Column(name = "case_id")
    private Long caseId;

    @Column(name = "contract_id")
    private Long contractId;

    @Column(name = "repay_by_customer_id")
    private Long repayByCustomerId;

    @Column(name = "repayment_plan_user_id")
    private Long repaymentPlanUserId;

    @Column(name = "repayment_operator_user_id")
    private Long repaymentOperatorUserId;

    @Column(name = "repayment_type", length = 10)
    private String repaymentType;

    @Column(name = "repay_amount", precision = 18, scale = 2)
    private BigDecimal repayAmount;

    @Column(name = "repay_at")
    private Instant repayAt;

    @Column(name = "repay_bank", length = 2000)
    private String repayBank;

    @Column(name = "repay_record_id")
    private Long repayRecordId;

    @Column(name = "confirmed_by")
    private Long confirmedBy;

    @Column(name = "confirmed_at")
    private Instant confirmedAt;

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

    @Column(name = "is_cleared")
    private Boolean isCleared;

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

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

    @Column(name = "is_delete")
    private Boolean isDelete;

}