package com.ecep.contract.controller;

import java.time.LocalDateTime;

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.model.CloudTyc;
import com.ecep.contract.model.Company;
import com.ecep.contract.service.CloudTycService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.CloudTycInfoViewModel;

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

/**
 * 天眼查信息管理窗口控制器
 */
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/cloud/tyc_manager.fxml")
public class CloudTycManagerWindowController
        extends AbstManagerWindowController<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin> {

    public static void show() {
        show(CloudTycManagerWindowController.class, null);
    }

    @Autowired
    private CloudTycService cloudTycService;

    @Autowired
    private CompanyService companyService;

    @FXML
    public TableColumn<CloudTycInfoViewModel, Number> idColumn;
    @FXML
    public TableColumn<CloudTycInfoViewModel, LocalDateTime> latestUpdateColumn;

    @FXML
    public TableColumn<CloudTycInfoViewModel, Company> companyColumn;
    @FXML
    public TableColumn<CloudTycInfoViewModel, String> cloudIdColumn;
    @FXML
    public TableColumn<CloudTycInfoViewModel, LocalDateTime> cloudLatestColumn;
    @FXML
    public TableColumn<CloudTycInfoViewModel, Number> scoreColumn;

    @FXML
    public TableColumn<CloudTycInfoViewModel, String> descriptionColumn;

    @Override
    public CloudTycService getViewModelService() {
        return cloudTycService;
    }

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

    @Override
    public void show(Stage stage) {
        super.show(stage);
        getTitle().set("数据源：天眼查");
    }
}
