function remove(varargin, options)
% REMOVE Internal implementation of TARGET.REMOVE.

%   Copyright 2018-2022 The MathWorks, Inc.

    arguments (Repeating)
        varargin
    end
    arguments
        options.IncludeAssociations = false
        options.IgnoreReusedObjects = true
        options.SuppressOutput = true
    end

    [varargin{:}] = convertCharsToStrings(varargin{:});

    % Create removal options.
    removeOptions = targetframework.internal.repository.RemoveOptions();
    removeOptions.IncludeAssociations = options.IncludeAssociations;
    removeOptions.IgnoreReusedObjects = options.IgnoreReusedObjects;

    % Remove with options.
    tr = targetframework.internal.repository.createTargetRepository();
    removeResults = tr.remove(varargin{:}, removeOptions);

    if ~options.SuppressOutput
        target.internal.printResults(removeResults);
    end
end
