package _VisualDVM.TestingSystem.DVM.DVMConfiguration;
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.DVMConfiguration.UI.DVMConfigurationsForm;
import _VisualDVM.TestingSystem.DVM.DVMConfigurationGroup.DVMConfigurationGroup;
import _VisualDVM.TestingSystem.DVM.DVMConfigurationSettings.DVMConfigurationSettings;
import _VisualDVM.TestingSystem.DVM.DVMConfigurationTest.DVMConfigurationTest;
import _VisualDVM.TestingSystem.DVM.DVMPackageConfiguration.DVMPackageConfiguration;

import javax.swing.*;
import java.util.LinkedHashMap;
public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
    public DVMConfigurationDBTable() {
        super(DVMConfiguration.class);
    }
    @Override
    public String getSingleDescription() {
        return "конфигурация";
    }
    @Override
    public String getPluralDescription() {
        return "конфигурации";
    }
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new DVMConfigurationsForm(this, mountPanel);
    }
    @Override
    public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
        LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
        res.put(DVMConfigurationGroup.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(DVMConfigurationTest.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(DVMConfigurationSettings.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
        res.put(DVMPackageConfiguration.class, new FKBehaviour(FKDataBehaviour.NONE, FKCurrentObjectBehaviuor.PASSIVE));
        return res;
    }
    //--
}
