package _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.UI.SapforSettingsCommandsForm;

import javax.swing.*;
import java.util.Vector;
public class SapforSettingsCommandsDBTable extends iDBTable<SapforSettingsCommand> {
    public SapforSettingsCommandsDBTable() {
        super(SapforSettingsCommand.class);
    }
    @Override
    public String getSingleDescription() {
        return "команда";
    }
    @Override
    public String getPluralDescription() {
        return "команды";
    }
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new SapforSettingsCommandsForm(this, mountPanel);
    }
    public Vector<PassCode> getCodes(SapforSettings sapforSettings) {
        Vector<PassCode> res = new Vector<>();
        for (SapforSettingsCommand command : Data.values()) {
            if (command.sapforsettings_id == sapforSettings.id)
                res.add(command.passCode);
        }
        return res;
    }
}
