classdef SettingsHandler
    % SETTINGSHANDLER provides the API for managing the workflow settings
    
    % Copyright 2019 The MathWorks, Inc.
    
    methods(Hidden)
        function updateSetting(~, strategyID, data)
            % get the data layer instance
            fptInstance = fxptui.FixedPointTool.getExistingInstance();
            model = fptInstance.getModel;
            dataLayer = fxptds.DataLayerInterface.getInstance();
            
            % capture the workflow setting and intent from the current
            % workflow
            currentWorkflow = dataLayer.getCurrentWorkflow(model);
            workflowSetting = currentWorkflow.WorkflowSetting;
            workflowIntent = currentWorkflow.WorkflowIntent;
            
            % create a strategy factory instance
            strategyFactory = fxptui.internal.workflowsetting.UpdateSettingStrategyFactory;
            updateSettingStrategy = strategyFactory.getStrategy(workflowIntent, strategyID);
            
            % update the setting
            updateSettingStrategy.update(workflowSetting, data);
        end
    end
end

