package com.ecep.contract.controller.employee;

import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.Employee;
import com.ecep.contract.service.EmployeeRoleService;
import com.ecep.contract.service.EmployeeService;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.vm.EmployeeViewModel;

import lombok.Setter;

public abstract class AbstEmployeeBasedTabSkin
        extends AbstEntityBasedTabSkin<EmployeeWindowController, Employee, EmployeeViewModel>
        implements TabSkin {
    @Setter
    private PermissionService permissionService;
    @Setter
    private EmployeeRoleService employeeRoleService;

    public AbstEmployeeBasedTabSkin(EmployeeWindowController controller) {
        super(controller);
    }

    protected EmployeeService getEmployeeService() {
        return controller.employeeService;
    }

    protected EmployeeRoleService getEmployeeRoleService() {
        if (employeeRoleService == null) {
            employeeRoleService = getBean(EmployeeRoleService.class);
        }
        return employeeRoleService;
    }

    protected PermissionService getPermissionService() {
        if (permissionService == null) {
            permissionService = getBean(PermissionService.class);
        }
        return permissionService;
    }
}
