class ExpirationDaysCheck implements Checker {

    @Override
    public ImportSummary check( ImmutableEvent event, WorkContext ctx )
    {
        final ImportOptions importOptions = ctx.getImportOptions();
        final Program program = ctx.getProgramsMap().get( event.getProgram() );
        final ProgramStageInstance programStageInstance = ctx.getProgramStageInstanceMap().get( event.getEvent() );

        if ( importOptions == null || importOptions.getUser() == null
            || importOptions.getUser().isAuthorized( Authorities.F_EDIT_EXPIRED.getAuthority() ) )
        {
            return success();
        }

        if ( program != null )
        {
            ImportSummary importSummary = checkEventOrPsiCompletedDate( program, event, programStageInstance );

            if ( importSummary.isStatus( ImportStatus.ERROR ) )
            {
                return importSummary;
            }

            return checkEventOrPsiExpirationDate( program, event, programStageInstance );

        }

        return success();
    }

}