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

import java.time.LocalDate;

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.ProductType;
import com.ecep.contract.service.ProductTypeService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProductTypeViewModel;

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

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/project/product-type-manager.fxml")
public class ProductTypeManagerWindowController extends AbstManagerWindowController<ProductType, ProductTypeViewModel, ProductTypeManagerSkin> {
    private static final Logger logger = LoggerFactory.getLogger(ProductTypeManagerWindowController.class);

    @Autowired
    private ProjectService projectService;
    @Autowired
    private ProductTypeService productTypeService;

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

    @Override
    public ProductTypeService getViewModelService() {
        return productTypeService;
    }

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

    @Override
    protected ProductTypeManagerSkin createDefaultSkin() {
        return new ProductTypeManagerSkin(this);
    }

    public void onSearchAction(ActionEvent event) {

    }

    public void onTableRefreshAction(ActionEvent event) {
        getSkin().loadTableDataSet(true);
    }


}
