package fastweb.domain.usertype;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

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

@Entity
@Data
@Table(name = "user")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
public class User {
    @Id
    @GeneratedValue(generator = "idGenerator")
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    @Column(name = "ID", nullable = false, length = 42)
    private String id;


    /**
     *  用户名
     */
    @Column(name = "ACCOUNT", nullable = false, length = 40)
    private String account;

    /**
     *  密码
     */
    @Column(name = "PASSWORD",nullable = false, length = 200)
    private String password;


    /**
     * 姓名
     */
    @Column(name = "name")
    private String name;

    /**
     * 编号
     */
    @Column(name = "code")
    private String code;

    /**
     * 性别
     */
    @Column(name = "sex")
    private String sex;

    /**
     * 年龄
     */
    @Column(name = "age")
    private String age;

    /**
     *  邮箱
     */
    @Column(name = "EMAIL",nullable = true)
    private String email;

    /**
     *  手机号
     */
    @Column(name = "PHONE",nullable = true)
    private String phone;

    /**
     *  创建时间
     */
    @Column(name = "CREATED_DATE",nullable = false)
    private Date createdDate;


    /**
     * 表示当前账户所属类型
     *  1 管理员
     *  2 用户
     */
    @Column(name = "TYPE",nullable = true)
    private String type;

    /**
     * 表示当前账户所属类型
     *  0 停用
     *  1 正常
     */
    @Column(name="STATUS",nullable = false)
    private Integer status;


    public User(){}
    public User(String id,String account, String password, String type, Integer status) {
        this.id = id;
        this.account = account;
        this.password = password;
        this.type = type;
        this.status = status;
    }
}
