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

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.ProjectIndustry;
import com.ecep.contract.service.ProjectIndustryService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectIndustryViewModel;

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

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/project/used-industry-manager.fxml")
public class ProjectIndustryManagerWindowController
        extends AbstManagerWindowController<ProjectIndustry, ProjectIndustryViewModel, ProjectIndustryManagerSkin> {

    @Autowired
    private ProjectService projectService;
    @Autowired
    private ProjectIndustryService projectIndustryService;

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


    @Override
    public void show(Stage stage) {
        super.show(stage);
        getTitle().set("用户行业类型管理");
    }

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

    @Override
    public ProjectIndustryService getViewModelService() {
        return projectIndustryService;
    }
}
