function [args,additionalargs,incrMakeFcn] = offlineTemplateParameters(mdl,varargin)
%

%   Copyright 2022-2023 The MathWorks, Inc.

    method = mdl.Method;    
    switch method
        case 'Linear'
            [args,additionalargs] = incremental.utils.offlineTemplateLinearParameters(mdl,"classification",varargin{:});
            incrMakeFcn = @incrementalClassificationLinear;
        case 'SVM'
            [args,additionalargs] = incremental.utils.offlineTemplateSVMParameters(mdl,"classification",varargin{:});
            incrMakeFcn = @incrementalClassificationLinear;
        case 'Kernel'
            [args,additionalargs] = incremental.utils.offlineTemplateLinearParameters(mdl,"classification",varargin{:});

            if isa(mdl,'classreg.learning.FitTemplate')
                mdl = fillIfNeeded(mdl,'classification');
            end

            % set parameters exclusive to kernel models : KernelScale,
            % RandomStream, NumExpansionDimensions and Standardize
            if ~isempty(mdl.ModelParams.KernelScale)
                additionalargs.KernelScale = mdl.ModelParams.KernelScale;
            end
            if ~isempty(mdl.ModelParams.NumExpansionDimensions)
                additionalargs.NumExpansionDimensions = mdl.ModelParams.NumExpansionDimensions;
            end
            if ~isempty(mdl.ModelParams.Stream)
                additionalargs.RandomStream = mdl.ModelParams.Stream; % user passed stream
            end
            if ~isempty(mdl.ModelParams.StandardizeData)
                additionalargs.Standardize = mdl.ModelParams.StandardizeData; 
            end
            incrMakeFcn = @incrementalClassificationKernel;
        otherwise
            error(message('stats:incremental:Template:UnsupportedTemplate',method));
    end

end