package _VisualDVM.TestingSystem.DVM.DVMSettings;
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.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptionsSet;
import _VisualDVM.TestingSystem.DVM.DVMConfigurationSettings.DVMConfigurationSettings;
import _VisualDVM.TestingSystem.DVM.DVMEnvironmentsSet.DVMEnvironmentsSet;
import _VisualDVM.TestingSystem.DVM.DVMSettings.UI.DVMSettingsForm;

import javax.swing.*;
import java.util.LinkedHashMap;
public class DVMSettingsDBTable extends iDBTable<DVMSettings> {
    public DVMSettingsDBTable() {
        super(DVMSettings.class);
    }
    @Override
    public String getSingleDescription() {
        return "параметры тестирования";
    }
    @Override
    public String getPluralDescription() {
        return "параметры тестирования";
    }
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new DVMSettingsForm(this, mountPanel);
    }
    @Override
    public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
        LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
        res.put(DVMConfigurationSettings.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(DVMCompilationOptionsSet.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(DVMEnvironmentsSet.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        return res;
    }
}
