classdef VariantConfigurationData< matlab.mixin.Copyable
%VariantConfigurationData
%    This class represents the data required to configure variants in a
%    model. A variant configuration data object stores a collection of
%    variant configurations and model wide constraints. A variant
%    configuration is essentially a set of variant control variables with
%    specific values. The Simulink.VariantConfigurationData class has
%    methods that enable you to add, modify, or remove variant
%    configurations, constraints, and control variables, and optionally
%    specify one configuration as the default. You can also validate and
%    activate a configuration for a model. Constraints are used to specify
%    high level requirements which must be satisfied by the model using the
%    variant configuration data object irrespective of the variant
%    configuration.
%    Simulink.VariantConfigurationData is a handle class.
%
%    VariantConfigurationData methods:
%
%    addConfiguration - Add new configuration to variant configuration data object
%    addConstraint - Add model wide constraint to variant configuration data object
%    addControlVariables - Add control variables to existing variant configuration
%    addCopyOfConfiguration - Add copy of existing variant configuration to variant configuration data object
%    addSubModelConfigurations - Add to variant configuration, names of configurations to be used for submodels
%    getConfiguration - Returns variant configuration with given name from variant configuration data object
%    getDefaultConfiguration - Returns default variant configuration, if any, for variant configuration data object
%    getFor - Get existing variant configuration data object for model
%    removeConfiguration - Remove variant configuration with given name from variant configuration data object
%    removeConstraint - Remove constraint from variant configuration data object
%    removeControlVariable - Remove control variable from variant configuration
%    removeSubModelConfiguration - Remove from variant configuration, configuration to be used for sub model
%    setDefaultConfigurationName - Set name of default variant configuration for variant configuration data object
%    validateModel - Validate and activate variant blocks in model

 
% Copyright 2012-2021 The MathWorks, Inc.

    methods
        function out=VariantConfigurationData
            %obj = VariantConfigurationData([variantConfigurations, [constraints, [defaultConfigurationName]]])
            %    The object constructor with optional arguments for variant configurations,
            %    constraints and default configuration name.
        end

        function out=addConfiguration(~) %#ok<STOUT>
            %addConfiguration (this, name, [description, [controlVars, [subModelConfigurations]]])
            %    Add a new variant configuration to the variant configuration data object.
        end

        function out=addConstraint(~) %#ok<STOUT>
            %addConstraint (this, nameOfConstraint, [condition, [description]])
            %    Add a constraint to the variant configuration data object.
        end

        function out=addControlVariables(~) %#ok<STOUT>
            %addControlVariables (this, nameOfConfiguration, controlVars)
            %    Add control variables to a variant configuration. 
            %    Example - To add multiple values:
            %    VariantConfigurationDataObject.addControlVariables('<configuration name>',...
            %        cell2struct(...
            %            {'ControlVariable1', '1';...
            %             'ControlVariable2', '3'},...
            %            {'Name', 'Value'}, 2));
        end

        function out=addCopyOfConfiguration(~) %#ok<STOUT>
            %addCopyOfConfiguration (this, nameOfExistingConfiguration, [nameOfTobeAddedConfiguration])
            %    Add a copy of a given variant configuration to the variant configuration data object.
        end

        function out=addSubModelConfigurations(~) %#ok<STOUT>
            %addSubModelConfigurations(this, nameOfConfiguration, subModelConfigurations)
            %    Add to a variant configuration, the configurations that must be used for
            %    the submodels. 
            %    Example - To add multiple values:
            %    VariantConfigurationDataObject.addControlVariables('<configuration name>',...
            %        cell2struct(...
            %            {'Model1', 'subModelConfiguration1';...
            %             'Model2', 'subModelConfiguration1'},...
            %            {'ModelName', 'ConfigurationName'}, 2));
        end

        function out=getConfiguration(~) %#ok<STOUT>
            %variantConfiguration = getConfiguration (this, nameOfConfiguration)
            %    Returns the variant configuration for a given name from the variant configuration data object.
        end

        function out=getDefaultConfiguration(~) %#ok<STOUT>
            %defaultConfiguration = getDefaultConfiguration (this)
            %    Returns default variant configuration, if any in the variant configuration data object.
            %    Note, it is recommended to avoid setting a default
            %    configuration. If a model is associated with a default
            %    configuration, doing an update diagram or simulating the
            %    model will always apply the default configuration
            %    irrespective of the current control variable values in the
            %    global workspace. Instead, activate/validate a desired
            %    configuration and then simulate the model.
        end

        function out=getFor(~) %#ok<STOUT>
            % variantConfigData = getFor (modelNameOrHandle)
            %    Get existing variant configuration data object for a model.
        end

        function out=removeConfiguration(~) %#ok<STOUT>
            %removeConfiguration (this, nameOfConfiguration)
            %    Remove a variant configuration with a given name from the variant configuration data object.
        end

        function out=removeConstraint(~) %#ok<STOUT>
            %removeConstraint (this, nameOfConstraint)
            %    Remove a constraint from the variant configuration data object.
        end

        function out=removeControlVariable(~) %#ok<STOUT>
            %removeControlVariable (this, nameOfConfiguration, nameOfControlVariable)
            %    Remove a control variable from a variant configuration.
        end

        function out=removeSubModelConfiguration(~) %#ok<STOUT>
            %removeSubModelConfiguration (this, nameOfConfiguration, nameOfSubModel)
            %    Remove from a variant configuration, the configuration to be used for a submodel.
        end

        function out=setDefaultConfigurationName(~) %#ok<STOUT>
            %setDefaultConfigurationName (this, nameOfConfiguration)
            %    Set name of the default variant configuration for the
            %    variant configuration data object. A variant configuration
            %    should exist with the same name. If an empty value is
            %    passed then the name is cleared. 
            %    Note, it is recommended to avoid setting a default
            %    configuration. If a model is associated with a default
            %    configuration, doing an update diagram or simulating the
            %    model will always apply the default configuration
            %    irrespective of the current control variable values in the
            %    global workspace. Instead, activate/validate a desired
            %    configuration and then simulate the model.
        end

        function out=validateModel(~) %#ok<STOUT>
            %[valid, errors] = validateModel (modelName, [configName])
            %    Validate and activate all variant blocks in the given
            %    model and submodels (or referenced models) in its hierarchy
            %    which will be used during simulation.
            %
            %    If 'VariantConfigurationObject' parameter of model is not empty then
            %    a scalar object of this class must exist in the base workspace with
            %    the same name. If configuration name is passed as an argument then
            %    a variant configuration must exist with the same name. Otherwise,
            %    default configuration, if any, is used. If no, default configuration
            %    is specified then validation happens using the variables defined in the
            %    base workspace.
        end

    end
    properties
        %Constraints
        %    Row vector of structs representing Constraints (Name, Condition, Description).
        %    The names of the constraints must be unique and valid MATLAB variable names. 
        Constraints;

        %DefaultConfigurationName
        %    The name of the variant configuration to be used by default for the given
        %    variant configuration data object.
        DefaultConfigurationName;

        %VariantConfigurations
        %    Row vector of structs representing variant configurations (Name, Description,
        %    ControlVariables, SubModelConfigurations). The names of the configurations
        %    must be unique and valid MATLAB variable names.
        VariantConfigurations;

    end
end
