package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.converter.EncryptConverter;
import com.izouma.nineth.enums.AuthStatus;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Data
@Entity
@Table(indexes = {@Index(columnList = "userId"), @Index(columnList = "idNo")})
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("身份认证")
public class IdentityAuth extends UserBaseEntity {

    @Searchable
    private Long userId;

    @Searchable
    private String realName;

    @Searchable
    private String phone;

    private String email;

    @Convert(converter = EncryptConverter.class)
    @Column(length = 80)
    private String idNo;

    @Convert(converter = EncryptConverter.class)
    private String idFront;

    @Convert(converter = EncryptConverter.class)
    private String idBack;

    private boolean org;

    private String orgName;

    private String orgNo;

    private String orgLicense;

    private String orgLicenseExpire;

    @Enumerated(EnumType.STRING)
    private AuthStatus status;

    private boolean autoValidated;

    private String reason;

}
