function [caseName par flagEnforce] = ...
    handleInput(argin, outCaseName)
%
%

% the input order is: (caseName, optional parameter struct, enforce)
flagNormalInput = ~isa(outCaseName, 'function_handle');

%% set default par and flagNormal
if flagNormalInput
    par = [];
else
    par = struct();
end
flagEnforce = 0;

%% set caseName, par and flagenForce
if numel(argin) == 0
    caseName = '';
    
elseif numel(argin) == 1
    caseName = argin{1};
    
elseif numel(argin) == 2
    caseName = argin{1};
    if flagNormalInput
        flagEnforce = argin{2};
    else
        par = argin{2};
    end
elseif numel(argin) == 3
    if flagNormalInput
        error('elk:database:wrongInput', 'Too many input arguments');
    else
        caseName = argin{1};
        par = argin{2};
        flagEnforce = argin{3};
    end
else
    error('elk:database:wrongInput', 'Too many input arguments');
end