/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.persistence.Id;
import javax.persistence.Table;
import org.mindrot.jbcrypt.BCrypt;

/**
 *
 * @author install1
 */
@Entity
public class AdminEditor implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    private String adminName;
    @Basic(optional = false)
    @NotNull
    private String adminPass;

    public AdminEditor() {
    }

    public boolean verifyPassword(String pw) {
        return (BCrypt.checkpw(pw, adminPass));
    }

    public AdminEditor(String adminName, String adminPass) {
        this.adminName = adminName;
        this.adminPass = BCrypt.hashpw(adminPass, BCrypt.gensalt());
    }

    public String getUserName() {
        return adminName;
    }

    public void setUserName(String adminName) {
        this.adminName = adminName;
    }

    public String getUserPass() {
        return this.adminPass;
    }

    public void setUserPass(String adminPass) {
        this.adminPass = adminPass;
    }

}
