function tf = isgroupbins(gb_,messageIdent)
%MATLAB Code Generation Library Function
% ISGROUPBINS Finds if gb is a groupbin specification


%   Copyright 2021 The MathWorks, Inc.
%#codegen
coder.internal.prefer_const(gb_,messageIdent);
if isstring(gb_)
    gb = {char(gb_)}; % equivalent to cellstr for codegen
elseif ~iscell(gb_)
    gb = {gb_};
else
    gb = gb_;
end

coder.internal.errorIf(isempty(gb), ['MATLAB:',messageIdent,':GroupBinsEmpty']); % Catch {} case
if isnumeric(gb{1}) || isduration(gb{1}) || isdatetime(gb{1})
    tf = true;
else
    if (ischar(gb{1}) && isrow(gb{1})) || isstring(gb{1})
        coder.internal.assert(coder.internal.isConst(gb),['MATLAB:',messageIdent,':CodegenGroupBinsMustBeConst']);
        startsWithValidGb = coder.const(feval('startsWith',{'none', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', ...
            'year', 'decade', 'century', 'secondofminute', 'minuteofhour', ...
            'hourofday', 'dayname','dayofweek', 'dayofmonth', 'dayofyear', 'weekofmonth',...
            'weekofyear', 'monthofyear', 'monthname', 'quarterofyear'},char(gb{1}),'IgnoreCase',true));
        tf = coder.const(feval('any',startsWithValidGb));
    else
        tf = false;
    end
end