#!/usr/bin/perl

# called as $self->messages('foo')->{bar}

return {
    msg => {

# used in templates & test suite to flag general validation failure:
		dfv_errors => 'Error - form validation failed:',
# used by templates to indicate validation failure on multiple fields:
		require_one => 'require at least one of the empty fields highlighted',
# used by templates to indicate failure to supply confirmation:
        confirm_change => 'require confirmation of change',
#-------------------------------------------------------------------------------
# messages used by LIMS::Validate & Controller::Ajax to flag specific validation
# failures - displayed in template using format specified in dfv_defaults.msgs.format
# in config:
		dfv_msgs => {
			alphanumeric     => 'only alpha-numeric characters [a-z & 0-9] allowed',
            centurian        => 'date is &gt;100 years ago !!',
			date_order       => 'check chronological order',
			invalid_date     => 'invalid date',
			invalid_datetime => 'invalid datetime',
			invalid_domain   => 'invalid email address (domain not allowed)',
			invalid_entry    => 'invalid', # used by Ajax controller only
            invalid_length   => 'invalid length',
			future_date      => 'invalid - date is in future',
			need_block_ref   => 'requires external reference entry',
			need_integer     => 'invalid format - numbers only required',
            no_spaces        => 'invalid format - no spaces allowed',
			not_unique       => 'entry already exists',
			numbers_only     => 'numeric format [0-9] required',
			referrer_code    => 'require C, D, E or CS, followed by 5-7 numbers',
			report_confirm   => 'require reason for change',
			single_word      => 'require single word, or words separated by underscore(s)',
			too_high 	     => 'exceeds maximum value',
			too_long	     => 'invalid format - too many characters',
            username         => 'invalid format - only [A-Z] or hyphen allowed',
			year_digits      => 'require 4-digit year',
        },

# messages used by FormValidator::Simple only:
        form_validator => {
            user => {
                pwds => {
                    DUPLICATION => 'your new password fields did not match, please try again',
                },
                old_password => {
                    LENGTH    => 'old password - length should be minimum 5 chars',
                    NOT_BLANK => 'old password - cannot be blank',
                },
                new_password => {
                    LENGTH    => 'new password - length should be minimum 5 chars',
                    NOT_BLANK => 'new password - cannot be blank',
                },
                new_password_confirm => {
                    LENGTH    => 'confirm new password - length should be minimum 5 chars',
                    NOT_BLANK => 'confirm new  password - cannot be blank',
                },
            },

            patient_data => {

            },

            settings => {
                admin_contact => {
                    NOT_BLANK   => 'admin contact - cannot be blank',
                    EMAIL_LOOSE => 'does not appear to be valid e-mail address',
                },
                admin_timeout => {
                    NOT_BLANK => 'admin timeout field - cannot be blank',
                    INT       => 'must be valid integer (0 to disable)',
                },
                default_user_timeout => {
                    NOT_BLANK => 'guest user timeout field - cannot be blank',
                    INT       => 'must be valid integer (0 to disable)',
                },
            },
        },

# messages used by controllers via stash/flash/error/die:
# $self->messages('foo')->{bar}
#-------------------------------------------------------------------------------
        # general success messages for record update/create/edit/delete:
		action => {
			create_success => 'new record created successfully',
			edit_success   => 'record updated successfully',
			delete_success => 'record deleted successfully',
		},
		# admin/config messages:
		admin => {
            no_sections
                => 'no lab sections defined yet - please enter at least one before assigning lab tests',
            no_screens
                => 'no screening terms defined yet - please enter at least one before assigning lab tests',
            no_tests
                => 'no lab tests defined yet - please enter at least one before assigning screen tests',
            no_groups
                => 'no user groups defined yet - please enter at least one before assigning group functions',
            no_functions
                => 'no user functions defined yet - please enter at least one before assigning group functions',
            no_diagnostic_categories
                => 'no diagnostic categories defined yet - please enter at least one before defining diagnoses',
            no_request_audit_categories
                => 'no request audit categories defined yet - please enter at least one before defining options',
            settings => {
                update_successful => 'application settings change successful',
                require_restart => 'you will need to re-start the application server for changes to take effect',
            },
			data_file => {
				prefix_error => 'file address needs to be complete - did you forget http(s):// ?',
				url_error => 'file address empty or file type incorrect (ie zip or csv)',
				not_csv => 'zip file did not contain a csv file',
				unrecognised => 'zip contents or uploaded filename "%s" is not a recognised filename',
				update_success => 'new data file upload successful',
				update_failed => 'data file upload and/or data file update failed',
			},
			error_code => {
				not_unique => 'error code %s already exists',
				config_update => 'error codes updated successfully',
			},
			clinician => {
				not_unique => 'combination of clinician code & location already exists',
				name_mismatch => 'surname mis-match with existing record for %s [%s]',
				create_success => 'new clinician entry successful',
				edit_success => 'referrer details updated successfully',
				failure => 'failed to create new clinician',
			},
			user => {
				edit_success => 'user details updated successfully',
				create_success => 'new user created successfully',
			},
            status_option => {
                position_not_unique => "duplicate entry in 'order' column",
            },
            screen_term => {
                not_unique => 'combination of description and category must be unique',
            },
            referral_source => {
                outreach => 'check post-code area in blood_tube.yml config file if adding new Outreach practice',
            },
        },
        ajax => {
            storage_vial_id => {
                empty => 'required field',
                too_long => 'invalid (too long)',
                duplicate => 'invalid ID (duplicate)',
            },
        },
		demographics => {
			pas_insufficient_info => 'Insufficient information to perform PAS search',
			pas_no_matches => 'No PAS matches',
			pas_verified => 'Patient demographics verified',
			pas_timeout => 'PAS server timeout - please try again',
			pas_insufficient_vars => 'Require at least 2 fields to perform PAS search',

			pds_timeout  => 'PDS timeout - please try again',
            pds_no_xml   => 'No xml data structure passed',
			pds_no_match => 'No Match',
			pds_insufficient_vars => 'Required fields not supplied',
		},
		file_upload => {
			unsuitable_filetype => 'file is not a zip or xls file',
			bcr_abl => {
				poor_quality => {
					summary => 'ABL copy number < 10000',
					result  => 'unsuitable for RQ-PCR analysis, ABL copy number < 10000',
				},
			},
			chimerism => {
				file_number => 'upload dir does not contain expected number of files',
			},
            reserved_chars => 'replacement of reserved characters in filename',
		},
        group_functions => {
            empty_functions_list => 'all functions have been cleared',
        },
        login => {
            enter_details => 'Please enter your login details:',
            already_logged_in => q!You are already logged in as '%s'!,
            login_failed => 'Username and/or password not recognised',
            logged_out => q!You have now logged out. For security reasons, please
				remember to close your browser.!, # can't - session deleted so it's lost
            email_not_found => 'Sorry, e-mail address not recognised',
            session_id_not_found => 'error recovering your data, please login manually',
            missing_attribute => 'missing "%s" attribute in configuration settings',
        },
        outreach => {
            alternate => 'both address and post-code required for alternate address section',
            missing_dates => 'have either missing or invalid dates',
            questionnaire_success => 'questionnaire data entered successfully',
            data_import_success => 'data import successful',
        },
		patient => {
			merge => {
				not_flagged => q!either no records were selected from col. A (from),
					or >1 record was selected in col. B (to)!,
				too_many => 'too many records found (%s) - you might want to refine your search',
				merge_success => 'patients merged successfully'
			},
			biohazard => '**** patient has other known biohazard sample record(s) ****',
		},
        registration => {
			empty_submission => 'Please enter something to search for and try again.',
            invalid_select => 'Sorry, your selection was invalid. I\'ve no idea why. Please try again.',
            confirmation_required => 'Confimation required before records can be updated',
            form_validated => 'Patient details validated, OK to submit',
            no_records_found => 'Found 0 records matching %s',
            no_request_form_id => 'Request form ID not found. Please check and resubmit.',
			cannot_delete_case => 'Patient case belongs to 1 or more requests - cannot be deleted',
			cannot_delete_patient => 'Patient has other requests - cannot be deleted',
        },
		request_edit => {
			edit_failed    => 'record not updated - perhaps there were no changes?',
            nhs_conflict   => 'cannot do single record change with an NHS number',
			edit_success   => '%s record(s) updated successfully',
            no_patient     => 'patient record does not exist - cannot change details',
			unlock_success => 'record unlocked',
			delete_success => 'record deleted',
		},
		results => {
			update_success => 'results data update successful',
			no_data_file   => 'appear to have no valid data file in directory',
			no_userid      => 'unrecognised username in data file',
			xs_data_files  => 'appear to have more than one data file in directory',
			empty_data     => 'cannot extract data from data file',
			empty_acquired => "cannot parse 'date acquired' val from data file",
			empty_result   => 'cannot extract flow data result from data file',
			filename_error => "internal 'filename' field doesn't match data file name",
			surname_error  => "internal 'surname' field doesn't match patient surname",
			dob_error	   => "internal 'dob' field doesn't match patient dob",
			invalid_date   => 'invalid date field format or values out of range',
            data_matches   => 'datafile details checked OK',
            missing_dob    => 'd.o.b field missing',
            missing_name   => 'surname field missing',
            no_lab_test    => 'required lab-test has not been requested',
            missing_filename => 'filename field missing',
			no_test_results => 'no data for selected section',
		},
		report => {
			revision_missing  => 'revision data is required if diagnosis is changed',
			not_screened      => 'cannot report an unscreened record',
			not_reported      => 'cannot authorise an unreported record',
			no_self_auth      => 'authorisation by original reporter not permitted',
            no_diag_change    => 'diagnosis "revision" entry submitted without '
									. 'a primary diagnosis change',
			no_auth_diagnosis => 'failed to log authorisation audit - don\'t know why',
            no_secure_email   => 'no secure contact address for user in contacts.lib',
			email_success     => 'mail server reports message was sent to %s successfully',
			email_failure     => 'mail server reports "%s"',
            no_report_history => 'no entry found in report history table',
			invalid_domain    => 'invalid email address (domain not allowed)',
		},
		search => {
			empty_submission => 'Please enter something to search for and try again.',
			no_records_found => 'No matching requests were found',
			too_many_records => 'Found too many requests to display (%s), please refine search and try again',
		},
        screen => {
            empty_screen_list => 'all tests have been cleared',
        },
        storage => {
            no_plate_data  => 'plate reader did not return any data, check scanner settings',
            no_plate_id    => 'plate reader did not return plate ID, check scanner settings',
            void_success   => 'successfully decoupled all vials from plate ID %s',
            vial_mismatch  => 'scanned barcode does not match vial selected for deletion',
            delete_success => 'vial deleted successfully',
        },
        user => {
            pwd_incorrect    => 'password incorrect, please try again',
            msg_deleted      => 'message delete success',
            msg_sent         => 'new message delivered OK',
            update_email     => q!you have no registered email address, please update in
                                'Resources / change registered email address'!,
            old_pwd_mismatch => 'old password incorrect, please try again',
            new_pwd_mismatch => 'your new password fields did not match, please try again',
            pwd_change_success => 'password change successful, please re-login:',
        },
		worklist => {
			no_tests_for_status => 'no outstanding tests with status = %s',
			no_outstanding_tests => 'no outstanding tests for %s section',
			no_outstanding_requests => 'no outstanding requests',
			no_lab_test_ids => 'no lab tests data received',
			no_request_ids  => 'no records selected for update',
			no_print_ids    => 'no records selected for printing',
			update_success  => 'records updated successfully',
			update_failure  => 'no records were updated',
			update_fails => 'record update failed, probably already deleted',
			print_labels_ok => 'printer reports labels printed successfully',
			dako_link_ok    => 'data file(s) transferred successfully',
			no_data_submitted => 'no data submitted',
			no_ref_supplied => 'no reference value was supplied',
		},

#-------------------------------------------------------------------------------
        _not_currently_used => {
			invalid_form => 'Validation error',
			missing_data => 'missing data - must complete all sections',
			no_history => 'Request does not appear to have any previous history', # also used for no id submitted
			duplicate_lab_number => 'lab number already used',
			duplicate_nhs_number => 'NHS number already used',
			search_again => 'Found %s records, please refine search',
		},
    },
}
