function mustBeA(A, C)
%MATLAB Code Generation Library Function

%   Copyright 2022-2022 The MathWorks, Inc.
%#codegen
coder.internal.allowEnumInputs;
coder.internal.allowHalfInputs;

narginchk(2, 2);

coder.internal.prefer_const(C);

coder.internal.assert(coder.internal.isConst(C), 'Coder:toolbox:mustBeAInput');

if isstring(C)
    coder.internal.assert(strlength(C) > 0, 'Coder:toolbox:mustBeAInput');
    coder.internal.assert(isa(A, C), 'MATLAB:validators:mustBeA', C);
elseif ischar(C) && isvector(C)
    coder.internal.assert(~isempty(C), 'Coder:toolbox:mustBeAInput');
    coder.internal.assert(isa(A, C), 'MATLAB:validators:mustBeA', C);
else
    coder.internal.assert(iscellstr(C), 'Coder:toolbox:mustBeAInput');
    coder.unroll;
    for k=1:numel(C)
        if isa(A, C{k})
            return;
        end
    end
    % Matching MATLAB behavior: The input must be at least one (not all) 
    % of the classes provided, but always succeed on an empty list.
    coder.internal.assert(isempty(C), 'MATLAB:validators:mustBeA', coder.const(@feval, "strjoin", C, ', '));
end
end