function dlgstruct = getDialogSchema(obj)
%

%   Copyright 2016-2018 The MathWorks, Inc.

  sutTextWidget  = getSutTextWidget(obj);
  covMetricGrp   = getCovMetricGroup(obj);
  testStrategy   = getStrategyComboBox(obj);
  maxTimeEditBox = getMaxTimeEditBox(obj);
  extStartButtonPanel = getStartCancelButtonPanel();
  
  extConfigGrp.Type  = 'group';
  extConfigGrp.Name  = 'Settings';
  extConfigGrp.Items = { sutTextWidget, covMetricGrp, testStrategy, maxTimeEditBox};
  
  dlgstruct.DialogTitle         = 'Simulink Design Verifier: Generate Tests for Missing Coverage';
  dlgstuct.MinMaxButtons        = false;
  dlgstruct.StandaloneButtonSet = extStartButtonPanel;
  dlgstruct.HelpMethod          = 'doc';
  dlgstruct.HelpArgs            = 'eig';
           
  dlgstruct.Items = { extConfigGrp};

end

function sutWidget = getSutTextWidget(obj)
     sutName           = get_param(obj.sutH, 'Name');
     sutWidget.Type    = 'text';
     sutWidget.Name    = [ 'System Under Test: ' sutName ];
     sutWidget.Enabled = true;
     sutWidget.ColSpan = [1 2];
end

function coverageMetricGrp = getCovMetricGroup(obj)
   % checkboxes
     decCheckBox.Type     = 'checkbox';
     decCheckBox.Name     = 'Decision';
     decCheckBox.Enabled  = false;
     decCheckBox.Value    = ~strcmp(obj.extopts.DVModelCoverageObjectives, 'None');
     decCheckBox.RowSpan  = [1 1];
     decCheckBox.ColSpan  = [1 1];
     decCheckBox.Tag      = 'decCheckBoxCovMetricTag';
     
     condCheckBox.Type    = 'checkbox';
     condCheckBox.Name    = 'Condition';
     condCheckBox.Enabled = false;
     condCheckBox.Value   = ~strcmp(obj.extopts.DVModelCoverageObjectives, 'None') || ...
                            ~strcmp(obj.extopts.DVModelCoverageObjectives, 'Decision');
     condCheckBox.RowSpan = [1 1];
     condCheckBox.ColSpan = [2 2];
     condCheckBox.Tag  = 'condCheckBoxCovMetricTag';
     
     mcdcCheckBox.Type    = 'checkbox';
     mcdcCheckBox.Name    = 'MCDC';
     mcdcCheckBox.Enabled = false;
     mcdcCheckBox.Value   = ~strcmp(obj.extopts.DVModelCoverageObjectives, 'None') || ...
                            ~strcmp(obj.extopts.DVModelCoverageObjectives, 'Decision') || ...
                            ~strcmp(obj.extopts.DVModelCoverageObjectives, 'ConditionDecision');
     mcdcCheckBox.RowSpan = [1 2];
     mcdcCheckBox.Tag  = 'mcdcCheckBoxCovMetricTag';
     
     sldvCheckBox.Type    = 'checkbox';
     sldvCheckBox.Name    = 'Simulink Design Verifier';
     sldvCheckBox.Enabled = false;
     sldvCheckBox.Value   = ~strcmp(obj.extopts.DVTestObjectives, 'DisableAll');
     sldvCheckBox.Tag     = 'sldvCheckBoxCovMetricTag';
     
     relBoundaryCheckBox.Type    = 'checkbox';
     relBoundaryCheckBox.Name    = 'Relational Boundary';
     relBoundaryCheckBox.Enabled = false;
     relBoundaryCheckBox.Value   = strcmp(obj.extopts.DVIncludeRelationalBoundary, 'on');
     relBoundaryCheckBox.Tag     = 'sldvCheckBoxCovMetricTag';

     coverageMetricGrp.Type  = 'group';
     coverageMetricGrp.Name  = 'Coverage metrics:';
     coverageMetricGrp.Items = {decCheckBox, condCheckBox, mcdcCheckBox, sldvCheckBox,relBoundaryCheckBox};
end

function stratComboBox = getStrategyComboBox(obj)
        stratComboBox.Name           = 'Test suite optimzation:';
        stratComboBox.Type           = 'combobox';
        stratComboBox.Value          = obj.extopts.DVTestSuiteOptimization;   
        stratComboBox.ObjectMethod   = 'setAnalysisStrategyCallback';
        stratComboBox.MethodArgs     = {'%dialog'};
        stratComboBox.ArgDataTypes   = {'handle'};
        stratComboBox.Mode           = true;
        stratComboBox.RowSpan        = [1 1];
        stratComboBox.ColSpan        = [1 4];
        stratComboBox.Tag            = 'StrategyComboBox';
        stratComboBox.Entries = {'Auto', 'IndividualObjectives', 'LongTestcases', ...
                                 'LargeModel (Nonlinear Extended)'};
end

function maxTimeEditBox = getMaxTimeEditBox(obj)
        maxTimeEditBox.Type           = 'edit';
        maxTimeEditBox.Name           = 'Maximum analysis time (sec):';
        maxTimeEditBox.Mode           = 1;
        maxTimeEditBox.Value          = obj.extopts.DVMaxProcessTime;
        maxTimeEditBox.ObjectMethod   = 'setMaxProcessingTimeCallback';
        maxTimeEditBox.MethodArgs   = {'%dialog'};
        maxTimeEditBox.ArgDataTypes = {'handle'};
        maxTimeEditBox.RowSpan        = [3 3];
        maxTimeEditBox.Tag            = 'AnalysisTimeoutEditBox';
end

function extStartButtonPanel = getStartCancelButtonPanel()
        button_start.Name         = 'Generate Test Cases';
        button_start.Type         = 'pushbutton';
        button_start.Enabled      = true;
        button_start.RowSpan      = [1 1];
        button_start.ColSpan      = [1 1];
        button_start.ObjectMethod = 'generateTestsButtonCallback';
        button_start.MethodArgs   = {'%dialog'};
        button_start.ArgDataTypes = {'handle'};
        button_start.Tag          = 'GenerateTestsButton';

        % Close button
        button_cancel.Name         = 'Close';
        button_cancel.Type         = 'pushbutton';
        button_cancel.RowSpan      = [1 1];
        button_cancel.ColSpan      = [2 2];
        button_cancel.ObjectMethod = 'closeExtenderButtonCallback';
        button_cancel.MethodArgs   = {'%dialog'};
        button_cancel.ArgDataTypes = {'handle'};
        button_cancel.Tag          = 'CloseExtenderButton';

        extStartButtonPanel.Type       = 'panel';
        extStartButtonPanel.Items      = {button_start, button_cancel};
        extStartButtonPanel.Visible    = 1;
        extStartButtonPanel.Alignment  = 10;
        extStartButtonPanel.LayoutGrid = [2 2];
        extStartButtonPanel.Tag        = 'buttons_group_tag';
        extStartButtonPanel.WidgetId   = 'buttons_group_widgetid';
end


