package com.eactive.httpmockserver.user.entity;

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

/**
 * PT_USER 내부사용자정보
 *
 * @author
 * @version 1.0
 */
@Entity
@Table(name = "PT_USER")
public class StaffUser extends User {

    private static final long serialVersionUID = 1L;

    /**
     * 업무사용자ID
     */
    @Column(name = "USER_ID", nullable = false)
    private String userId;


    /**
     * 사용자상태코드
     */
    @Column(name = "EMPLYR_STTUS_CODE", nullable = false)
    @Enumerated(EnumType.STRING)
    private UserStatus status;

    /**
     * 이동전화번호
     */
    @Column(name = "MBTLNUM")
    private String mobilePhone;

    /**
     * 비밀번호
     */
    @Column(name = "PASSWORD", nullable = false)
    private String password;

    @Transient
    private String password2;

    /**
     * 비밀번호정답
     */
    @Column(name = "PASSWORD_CNSR")
    private String passwordCnsr;

    /**
     * 비밀번호힌트
     */
    @Column(name = "PASSWORD_HINT")
    private String passwordHint;

    /**
     * 사용자명
     */
    @Column(name = "USER_NM", nullable = false)
    private String username;

    @ManyToOne
    @JoinColumn(name = "USER_GROUP_ID")
    private UserGroup group;


    @Override
    public UserStatus getStatus() {
        return status;
    }

    @Override
    public void setStatus(UserStatus status) {
        this.status = status;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword2() {
        return password2;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    public String getPasswordCnsr() {
        return passwordCnsr;
    }

    public void setPasswordCnsr(String passwordCnsr) {
        this.passwordCnsr = passwordCnsr;
    }

    public String getPasswordHint() {
        return passwordHint;
    }

    public void setPasswordHint(String passwordHint) {
        this.passwordHint = passwordHint;
    }


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String getUserId() {
        return userId;
    }

    @Override
    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Override
    public String getUserSe() {
        return "USR";
    }

    public UserGroup getGroup() {
        return group;
    }

    public void setGroup(UserGroup group) {
        this.group = group;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        StaffUser staffUser = (StaffUser) o;
        return Objects.equals(userId, staffUser.userId) && status == staffUser.status && Objects.equals(mobilePhone, staffUser.mobilePhone) && Objects.equals(password, staffUser.password) && Objects.equals(passwordCnsr, staffUser.passwordCnsr) && Objects.equals(passwordHint, staffUser.passwordHint) && Objects.equals(username, staffUser.username);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, status, mobilePhone, password, passwordCnsr, passwordHint, username);
    }
}
