function [upToDate, message] = checkInterim(pArtoaWorkspace)
%CHECKINTERIMVERSION Summary of this function goes here
%   Detailed explanation goes here


%% Initialize return variables
upToDate = true;
message = '';

%% Check if the stored version is the most recent one
currentArtoaVersion = str2num(artoa.versioning.getVersionString(true));
maxMigration = artoa.versioning.migrations.getLatestVersionNumber();

if ~isfield(pArtoaWorkspace, 'artoaVersion')
    message = [ ...
    'You loaded an iterim file with an unknown Version.' newline ...
    'Your artoa4 instance is on Version 4.' num2str(currentArtoaVersion) '.' newline ...
    'Please consider upgrading your interim file using the' newline newline ...
    'artoa.upgradeInterim(yourArtoaFilePath)' newline newline ...
    'command.' newline ...
    'Artoa might be unstable otherwise!'
    ];
    upToDate = false;
    return;
end

workspaceVersion = str2num(pArtoaWorkspace.artoaVersion(2:end));
if workspaceVersion < currentArtoaVersion & workspaceVersion < maxMigration
    message = [ ...
        'You loaded an iterim file that has Version 4.' ...
        num2str(workspaceVersion) ...
        '.' newline ...
        'Your artoa4 instance is on Version 4.' num2str(currentArtoaVersion) '.' newline ...
        'Please consider upgrading your interim file using the' newline newline ...
        'artoa.upgradeInterim(yourArtoaFilePath)' newline newline ...
        'command.' newline ...
        'Artoa might be unstable otherwise!'
        ];
    upToDate = false;
end

