package com.bizzan.bitrade.entity;

import com.bizzan.bitrade.constant.AuditStatus;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * 代理商申请表实体
 *
 * @author admin
 * @date 2026-05-14
 */
@Entity
@Table(name = "agent_apply")
@Data
public class AgentApply {

    /** 主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 申请人会员ID
     */
    @Column(name = "member_id", nullable = false)
    private Long memberId;

    /**
     * 真实姓名
     */
    @Column(name = "real_name", nullable = false, length = 50)
    private String realName;

    /**
     * 联系电话
     */
    @Column(name = "phone", nullable = false, length = 20)
    private String phone;

    /**
     * 联系邮箱
     */
    @Column(name = "email", length = 100)
    private String email;

    /**
     * 申请代理地区
     */
    @Column(name = "region", length = 100)
    private String region;

    /**
     * 申请说明/备注
     */
    @Column(name = "remark", length = 500)
    private String remark;

    /**
     * 审核状态：0=待审核 1=审核失败 2=审核通过
     *
     * @see AuditStatus
     */
    @Column(name = "audit_status", nullable = false)
    @Enumerated(EnumType.ORDINAL)
    private AuditStatus auditStatus = AuditStatus.AUDIT_ING;

    /**
     * 拒绝原因（审核失败时填写）
     */
    @Column(name = "reject_reason", length = 500)
    private String rejectReason;

    /**
     * 申请时间
     */
    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time", nullable = false, updatable = false)
    private Date createTime;

    /**
     * 更新时间
     */
    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "update_time", nullable = false)
    private Date updateTime;
}
