package SapforTestingSystem.SapforTask;
import Common.Current;
import Common.Database.DBTable;
import Common.UI.DataSetControlForm;

import static Common.UI.Tables.TableRenderers.RendererStatusEnum;
public class SapforTasksDBTable extends DBTable<Long, SapforTask> {
    public SapforTasksDBTable() {
        super(Long.class, SapforTask.class);
    }
    @Override
    public String getSingleDescription() {
        return "задача";
    }
    @Override
    public String getPluralDescription() {
        return "задачи";
    }
    @Override
    public Current CurrentName() {
        return Current.SapforTask;
    }
    @Override
    protected DataSetControlForm createUI() {
        return new DataSetControlForm(this) {
            @Override
            protected void AdditionalInitColumns() {
                columns.get(4).setRenderer(RendererStatusEnum);
            }
            @Override
            public void MouseAction2() throws Exception {
              //  Pass_2021.passes.get(PassCode_2021.OpenSapforTest).Do();
            }
            /*
            @Override
            public boolean hasCheckBox() {
                return true;
            }
             */
        };
    }
    @Override
    public String[] getUIColumnNames() {
        return new String[]{
                "Группа",
                "Тест",
                "Флаги",
                "Статус",
                "Версии"
        };
    }
    @Override
    public Object getFieldAt(SapforTask object, int columnIndex) {
        switch (columnIndex) {
            case 1:
                return object.group_description;
            case 2:
                return object.test_description;
            case 3:
                return object.flags;
            case 4:
                return object.state;
            case 5:
                return object.versionsDescription;
            default:
                return null;
        }
    }
}
