package com.ecep.contract.controller.permission;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.service.EmployeeRoleService;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.EmployeeRoleViewModel;

import javafx.event.ActionEvent;
import javafx.scene.control.TableColumn;
import javafx.stage.Stage;

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/employee/roles-manager.fxml")
public class EmployeeRoleManagerWindowController
        extends AbstManagerWindowController<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin> {
    private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleManagerWindowController.class);

    @Autowired
    private PermissionService permissionService;
    @Autowired
    EmployeeRoleService employeeRoleService;

    public TableColumn<EmployeeRoleViewModel, Number> idColumn;
    public TableColumn<EmployeeRoleViewModel, String> codeColumn;
    public TableColumn<EmployeeRoleViewModel, String> nameColumn;
    public TableColumn<EmployeeRoleViewModel, Boolean> systemAdministratorColumn;
    public TableColumn<EmployeeRoleViewModel, Boolean> managerColumn;
    public TableColumn<EmployeeRoleViewModel, Boolean> activeColumn;

    @Override
    protected EmployeeRoleManagerSkin createDefaultSkin() {
        EmployeeRoleManagerSkin skin = new EmployeeRoleManagerSkin(this);
        skin.setPermissionService(permissionService);
        return skin;
    }

    @Override
    public void show(Stage stage) {
        super.show(stage);
        getTitle().set("角色管理");
    }

    public void onCreateNewAction(ActionEvent event) {
    }

    public void onReBuildFilesAction(ActionEvent event) {
    }

    @Override
    public EmployeeRoleService getViewModelService() {
        return employeeRoleService;
    }
}
