package com.ecep.contract.controller.project.project_type;

import java.time.LocalDate;

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.ProjectType;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.service.ProjectTypeService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectTypeViewModel;

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

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/project/project-type-manager.fxml")
public class ProjectTypeManagerWindowController
        extends AbstManagerWindowController<ProjectType, ProjectTypeViewModel, ProjectTypeManagerSkin> {

    @Autowired
    private ProjectService projectService;
    @Autowired
    private ProjectTypeService projectTypeService;

    public TableColumn<ProjectTypeViewModel, Number> idColumn;
    public TableColumn<ProjectTypeViewModel, String> nameColumn;
    public TableColumn<ProjectTypeViewModel, String> codeColumn;
    public TableColumn<ProjectTypeViewModel, String> descriptionColumn;
    public TableColumn<ProjectTypeViewModel, LocalDate> createdColumn;


    @Override
    public void show(Stage stage) {
        super.show(stage);
        getTitle().set("项目类型管理");
    }

    @Override
    protected ProjectTypeManagerSkin createDefaultSkin() {
        ProjectTypeManagerSkin skin = new ProjectTypeManagerSkin(this);
        skin.setProjectService(projectService);
        return skin;
    }

    @Override
    public ProjectTypeService getViewModelService() {
        return projectTypeService;
    }
}
