package xyz.wbsite.dbtool.javafx.po;

import javafx.scene.control.TreeItem;
import xyz.wbsite.dbtool.javafx.annotation.Property;

import java.util.ArrayList;
import java.util.List;

public class Project extends TreeItem {

    public Project() {
        this.projectName = "example-web";
        this.projectBasePackage = "com.example";
        this.projectAuthor = "author";
        this.needSys = true;
        this.needEMail = false;
        this.needCloud = false;
        this.database = DataBase.MySQL;
    }

    public Project(String projectName) {
        this.projectName = projectName;
        setValue(projectName);
        setExpanded(true);
    }

    @Property("projectName")
    private String projectName;
    @Property("projectBasePackage")
    private String projectBasePackage;
    @Property("projectAuthor")
    private String projectAuthor;
    @Property("needMoreDB")
    private boolean needMoreDB;
    @Property("needEMail")
    private boolean needEMail;
    @Property("needSys")
    private boolean needSys;
    @Property("needCloud")
    private boolean needCloud;
    @Property("needAsync")
    private boolean needAsync;
    @Property(value = "database")
    private DataBase database;

    /**
     * 对象
     */
    private List<Module> modules = new ArrayList();

    public boolean putModule(Module module) {
        modules.add(module);
        this.getChildren().add(module);
        return true;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
        this.setValue(projectName);
    }

    public String getProjectBasePackage() {
        return projectBasePackage;
    }

    public void setProjectBasePackage(String projectBasePackage) {
        this.projectBasePackage = projectBasePackage;
    }

    public String getProjectAuthor() {
        return projectAuthor;
    }

    public void setProjectAuthor(String projectAuthor) {
        this.projectAuthor = projectAuthor;
    }

    public List<Module> getModules() {
        return modules;
    }

    public void setModules(List<Module> modules) {
        this.modules = modules;
    }

    public boolean isNeedMoreDB() {
        return needMoreDB;
    }

    public void setNeedMoreDB(boolean needMoreDB) {
        this.needMoreDB = needMoreDB;
    }

    public boolean isNeedSys() {
        return needSys;
    }

    public void setNeedSys(boolean needSys) {
        this.needSys = needSys;
    }

    public boolean isNeedCloud() {
        return needCloud;
    }

    public void setNeedCloud(boolean needCloud) {
        this.needCloud = needCloud;
    }

    public DataBase getDatabase() {
        return database;
    }

    public void setDatabase(DataBase database) {
        this.database = database;
    }

    public boolean isNeedEMail() {
        return needEMail;
    }

    public void setNeedEMail(boolean needEMail) {
        this.needEMail = needEMail;
    }

    public boolean isNeedAsync() {
        return needAsync;
    }

    public void setNeedAsync(boolean needAsync) {
        this.needAsync = needAsync;
    }
}
