package com.ecep.contract.controller.project.sale_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.ProjectSaleType;
import com.ecep.contract.service.SaleTypeService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectSaleTypeViewModel;

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

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/project/sale-type-manager.fxml")
public class ProjectSaleTypeManagerWindowController
        extends AbstManagerWindowController<ProjectSaleType, ProjectSaleTypeViewModel, ProjectSaleTypeManagerSkin> {

    @Autowired
    private SaleTypeService saleTypeService;

    public TableColumn<ProjectSaleTypeViewModel, Number> idColumn;
    public TableColumn<ProjectSaleTypeViewModel, String> nameColumn;
    public TableColumn<ProjectSaleTypeViewModel, String> codeColumn;
    public TableColumn<ProjectSaleTypeViewModel, String> pathColumn;
    public TableColumn<ProjectSaleTypeViewModel, Boolean> storeByYearColumn;
    public TableColumn<ProjectSaleTypeViewModel, String> descriptionColumn;
    public TableColumn<ProjectSaleTypeViewModel, LocalDate> createdColumn;
    public TableColumn<ProjectSaleTypeViewModel, Boolean> activeColumn;

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


    @Override
    protected ProjectSaleTypeManagerSkin createDefaultSkin() {
        ProjectSaleTypeManagerSkin skin = new ProjectSaleTypeManagerSkin(this);
        skin.setSaleTypeService(saleTypeService);
        return skin;
    }


    @Override
    public SaleTypeService getViewModelService() {
        return saleTypeService;
    }
}
