classdef BaselineCollectHandler < fxptui.Web.CallbackService.IterativeCollectHandler
    % Class to handle the work for Collect Callback in FPT.
    
    % Copyright 2019 The MathWorks, Inc.
    
    properties(Constant)
        ActionID = fxptui.internal.ActionFactory.CollectID;
    end
    
    methods
        
        function prepare(~, varargin)
            fptInstance = varargin{1};
            clientData = varargin{3};
            
            %verify the validity of the simulation input object in base
            %workspace
            model = fptInstance.getModel();
            diagnostic = fxptui.Web.CallbackService.refreshSimulationInput(clientData, model);
            if ~isempty(diagnostic)
                throw(diagnostic);
            end
            
            % Disable code-view if present
            fptInstance.enableCodeView(false);
            
            % setting isFPTCallbackSource to true prevents fptoolcallback
            % updatesiglog from updating data before simulation is complete
            fptInstance.isFPTCallbackSource = true;
            
        end
        
    end
    
    methods(Hidden)
        
        function collectionSettings = getCollectionSettings(~, workflowSetting)
            % get the DataTypeWorkflow.CollectionSettings from the WorkflowSetting
            collectionSettings = workflowSetting.getSettingValue('CollectionSetting');
        end
        
    end
    
end
