package com.chushang.loan.domin.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import com.chushang.common.mybatis.annotation.Condition;
import com.chushang.common.mybatis.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 借贷业务数据表 实体类。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "loan")
@Builder
public class LoanEntity extends BaseEntity {

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 渠道id
     */
    @TableField(value = "dept_id")
    @Condition(name = "dept_id", type = Condition.ConditionType.eq)
    private Long deptId;

    /**
     * 渠道名
     */
    @TableField(value = "channel_name")
    @Condition(name = "channel_name", type = Condition.ConditionType.like)
    private String channelName;

    /**
     * 表单编号
     */
    @TableField(value = "form_number")
    @Condition(name = "form_number", type = Condition.ConditionType.eq)
    private String formNumber;

    /**
     * 提交人姓名
     */
    @TableField(value = "author_name")
    @Condition(name = "author_name", type = Condition.ConditionType.like)
    private String authorName;

    /**
     * 提交人手机号
     */
    @TableField(value = "author_phone")
    @Condition(name = "author_phone", type = Condition.ConditionType.eq)
    private String authorPhone;

    /**
     * 提交时间
     */
    @TableField(value = "submission_time")
    private LocalDateTime submissionTime;

    /**
     * 客户姓名
     */
    @TableField(value = "customer_name")
    private String customerName;

    /**
     * 客户手机号
     */
    @TableField(value = "customer_phone")
    private String customerPhone;

    /**
     * 申请金额
     */
    @TableField(value = "application_amount")
    private BigDecimal applicationAmount;

    /**
     * 房屋地址
     */
    @TableField(value = "house_address")
    private String houseAddress;

    /**
     * 房屋面积
     */
    @TableField(value = "house_area")
    private String houseArea;

    /**
     * 跟进状态 1 待审核  2 审核成功  3 审核拒绝
     */
    @TableField(value = "status")
    @Condition(name = "status", type = Condition.ConditionType.eq)
    private Integer status;

    /**
     * 放款金额
     */
    @TableField(value = "loan_amount")
    private BigDecimal loanAmount;

    /**
     * 拒绝原因
     */
    @TableField(value = "denial_reason")
    private String denialReason;


    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Condition(name = "submission_time", type = Condition.ConditionType.between)
    @TableField(exist = false)
    private List<LocalDateTime> submissionTimes;


}
