function dlgstruct = getDialogSchema(hSrc, schemaName)
%GETDIALOGSCHEMA - returns the dialog struct for display in a DDG

% Copyright 2004-2020 The MathWorks, Inc.

dlgstruct = [];

%=======================================================================
% The BuildArgs are displayed in a table
%=======================================================================
BuildArgs = [];
BuildArgs.Name = string(message('coder_compile:buildInfo:BuildArgsLabel'));
BuildArgs.Type = 'table';
BuildArgs.Enabled = true;
BuildArgs.Size = [length(hSrc.BuildArgs) 3];
BuildArgs.Grid = true;
BuildArgs.ColHeader = {string(message('coder_compile:buildInfo:GroupLabel')),...
string(message('coder_compile:buildInfo:BuildArgLabel')),...
string(message('coder_compile:buildInfo:ValueLabel'))};
BuildArgs.HeaderVisibility = [0 1];

if (length(hSrc.BuildArgs) > 1)
BuildArgs.Data(:,1) = get(hSrc.BuildArgs,'Group');
BuildArgs.Data(:,2) = get(hSrc.BuildArgs,'Key');
BuildArgs.Data(:,3) = get(hSrc.BuildArgs,'Value');
else
BuildArgs.Data(1,1) = {get(hSrc.BuildArgs,'Group')};
BuildArgs.Data(1,2) = {get(hSrc.BuildArgs,'Key')};
BuildArgs.Data(1,3) = {get(hSrc.BuildArgs,'Value')};
end

BuildArgs.ToolTip = string(message('coder_compile:buildInfo:BuildArgsToolTip'));
BuildArgs.Mode = 1;

%=======================================================================
% The Tokens are displayed in a table
%=======================================================================
Tokens = [];
Tokens.Name = string(message('coder_compile:buildInfo:TokensLabel'));
Tokens.Type = 'table';
Tokens.Enabled = true;
Tokens.Size = [length(hSrc.Tokens) 3];
Tokens.Grid = true;
Tokens.ColHeader = {string(message('coder_compile:buildInfo:GroupLabel')),...
string(message('coder_compile:buildInfo:TokenLabel')),...
string(message('coder_compile:buildInfo:ValueLabel'))};
Tokens.HeaderVisibility = [0 1];

if (length(hSrc.Tokens) > 1)
Tokens.Data(:,1) = get(hSrc.Tokens,'Group');
Tokens.Data(:,2) = get(hSrc.Tokens,'Key');
Tokens.Data(:,3) = get(hSrc.Tokens,'Value');
else
Tokens.Data(1,1) = {get(hSrc.Tokens,'Group')};
Tokens.Data(1,2) = {get(hSrc.Tokens,'Key')};
Tokens.Data(1,3) = {get(hSrc.Tokens,'Value')};
end

Tokens.ToolTip = string(message('coder_compile:buildInfo:TokenToolTip'));
Tokens.Mode = 1;

%=======================================================================
% layout the widgets
%=======================================================================
BuildArgs.RowSpan = [1 1];
BuildArgs.ColSpan = [1 3];

Tokens.RowSpan = [2 2];
Tokens.ColSpan = [1 3];

group.Name = string(message('coder_compile:buildInfo:BuildInfoLabel'));
group.Type = 'group';
group.LayoutGrid = [2 2];
group.Items = {BuildArgs, Tokens};

dlgstruct.DialogTitle = hSrc.getDisplayLabel;
dlgstruct.Items = {group};