package _VisualDVM.GlobalData.Makefile;
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.Makefile.UI.MakefilesForm;
import _VisualDVM.GlobalData.Module.Module;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;

import javax.swing.*;
import java.util.LinkedHashMap;
public class MakefilesDBTable extends iDBTable<Makefile> {
    public MakefilesDBTable() {
        super(Makefile.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(Module.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
        res.put(CompilationTask.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
        return res;
    }
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new MakefilesForm(this, mountPanel);
    }
}
