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

%   Copyright 2021-2022 The MathWorks, Inc.
disallowedParams = {'Coding'};

ecocParamsList = [{'BinaryLoss','Decoding','UpdateBinaryLearnerMetrics',...
                   },disallowedParams];
try
    cleanedupargs = incremental.utils.partialMatchParameters(ecocParamsList,"classification",varargin{:});
    additionalargs = incremental.utils.validateDisallowedParameters(mdl,disallowedParams,cleanedupargs);

    args = struct();
    args.BinaryLearners = cell(size(mdl.BinaryLearners));
    
    try
       % No need to call incrementalLearner on empty binary learners
        hasLearnerInds = ~cellfun(@isempty,mdl.BinaryLearners);
        
        args.BinaryLearners(hasLearnerInds) = cellfun(@incrementalLearner,mdl.BinaryLearners(hasLearnerInds),'UniformOutput',false);
    catch
        error(message('stats:incremental:Offline:InvalidBinaryLearners'))
    end

    args.NumPredictors = size(mdl.PredictorNames,2);
    args.CodingMatrix = mdl.CodingMatrix;

    if isa(mdl,'ClassificationECOC')
        args.Coding = mdl.CodingName;        
    else
        % Coding name is not preserved in the compact object
        args.Coding = 'converted';
    end

    args.CodingMatrix = mdl.CodingMatrix;
    args.BinaryLoss = mdl.BinaryLoss;
    args.DefaultScoreType = mdl.DefaultScoreType;
catch ME
    throwAsCaller(ME);
end
end
