package _VisualDVM.GlobalData.Compiler;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.FKBehaviour;
import Common.Database.Tables.FKCurrentObjectBehaviuor;
import Common.Database.Tables.FKDataBehaviour;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.GlobalData.Compiler.UI.CompilersForm;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Module.Module;
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;

import javax.swing.*;
import java.util.LinkedHashMap;
public class CompilersDBTable extends iDBTable<Compiler> {
    public CompilersDBTable() {
        super(Compiler.class);
    }
    @Override
    public String getSingleDescription() {
        return "компилятор";
    }
    @Override
    public String getPluralDescription() {
        return "компиляторы";
    }
    @Override
    public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
        LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
        res.put(Makefile.class, new FKBehaviour(FKDataBehaviour.DROP, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(Module.class, new FKBehaviour(FKDataBehaviour.DROP, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(RunConfiguration.class, new FKBehaviour(FKDataBehaviour.DROP, FKCurrentObjectBehaviuor.PASSIVE));
        return res;
    }
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new CompilersForm(this, mountPanel);
    }
}
