package by.bsuir.mpp.computershop.entity;

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

@Entity
@Table(name = "employee_auth")

public class EmployeeAuth extends BaseEntity<Long> {

    @Enumerated(EnumType.STRING)
    @Column(name = "role", columnDefinition = "ENUM ('RECEIVER', 'ASSEMBLER', 'MANAGER', 'DIRECTOR', 'ADMIN')", nullable = false)
    private Role role;

    @Column(name = "pass_hash", unique = true, nullable = false)
    private String passHash;

    @Column(name = "blocked", columnDefinition = "bit", nullable = false)
    private Boolean blocked;

    @Column(name = "deleted", columnDefinition = "bit", nullable = false)
    private Boolean deleted;

    @OneToOne(mappedBy = "auth", cascade = CascadeType.ALL)
    private EmployeeInfo employeeInfo;

    @OneToMany(mappedBy = "assembler", cascade = CascadeType.ALL)
    private List<AssemblerTask> assemblerTask;

    public List<AssemblerTask> getAssemblerTask() {
        return assemblerTask;
    }

    public void setAssemblerTask(List<AssemblerTask> assemblerTask) {
        this.assemblerTask = assemblerTask;
    }

    public EmployeeInfo getEmployeeInfo() {
        return employeeInfo;
    }

    public void setEmployeeInfo(EmployeeInfo employeeInfo) {
        this.employeeInfo = employeeInfo;
    }

    public String getPassHash() {
        return this.passHash;
    }

    public void setPassHash(String passHash) {
        this.passHash = passHash;
    }

    public Boolean getStatus() {
        return this.blocked;
    }

    public void setStatus(Boolean blocked) {
        this.blocked = blocked;
    }

    public Boolean getDeleted() {
        return this.deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public Role getRole() {
        return this.role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public enum Role {
        RECEIVER {
            public String toString() {
                return "Приемщик";
            }
        },
        ASSEMBLER {
            public String toString() {
                return "Сборщик ПК";
            }
        },
        MANAGER {
            public String toString() {
                return "Менеджер";
            }
        },
        DIRECTOR {
            public String toString() {
                return "Директор";
            }
        },
        ADMIN {
            public String toString() {
                return "Администратор";
            }
        };

        public abstract String toString();
    }
}

@@ -182,16 +182,71 @@
 ong%3E %7B%0A%0A
+    @Column(name = %22email%22)%0A    private String email;%0A%0A
     @Enu
@@ -868,35 +868,8 @@
 ler%22
-, cascade = CascadeType.ALL
 )%0A  
@@ -914,16 +914,354 @@
 rTask;%0A%0A
+    public EmployeeAuth() %7B%0A%0A    %7D%0A%0A    public EmployeeAuth(EmployeeAuth employeeAuth) %7B%0A        email = employeeAuth.email;%0A        role = employeeAuth.role;%0A        passHash = employeeAuth.passHash;%0A        blocked = employeeAuth.blocked;%0A        deleted = employeeAuth.deleted;%0A        employeeInfo = employeeAuth.employeeInfo;%0A    %7D%0A%0A
     publ
@@ -2242,32 +2242,168 @@
  = role;%0A    %7D%0A%0A
+    public String getEmail() %7B%0A        return email;%0A    %7D%0A%0A    public void setEmail(String email) %7B%0A        this.email = email;%0A    %7D%0A%0A
     public enum 

Update EmployeeAuth entity