// Declaration above is needed for: https://github.com/hapijs/joi/issues/3064

import joi from 'joi';
import { lowerFirstPreserveProperNouns } from "../components/helpers/index.js";
export const opts = {
  functions: {
    lowerFirst: lowerFirstPreserveProperNouns
  }
};

/**
 * see @link https://joi.dev/api/?v=17.4.2#template-syntax for template syntax
 */
export const messageTemplate = {
  declarationRequired: joi.expression('You must confirm you understand and agree with the {{lowerFirst(#label)}} to continue', opts),
  required: joi.expression('Enter {{lowerFirst(#label)}}', opts),
  selectRequired: joi.expression('Select {{lowerFirst(#label)}}', opts),
  selectYesNoRequired: '{{#label}} - select yes or no',
  max: '{{#label}} must be {{#limit}} characters or less',
  min: '{{#label}} must be {{#limit}} characters or more',
  minMax: '{{#label}} must be between {{#min}} and {{#max}} characters',
  pattern: joi.expression('Enter a valid {{lowerFirst(#label)}}', opts),
  format: joi.expression('Enter {{lowerFirst(#label)}} in the correct format', opts),
  unicode: '{{#label}} includes invalid characters, for example, long dashes',
  number: '{{#label}} must be a number',
  numberPrecision: '{{#label}} must have {{#limit}} or fewer decimal places',
  numberInteger: '{{#label}} must be a whole number',
  numberMin: '{{#label}} must be {{#limit}} or higher',
  numberMax: '{{#label}} must be {{#limit}} or lower',
  maxWords: '{{#label}} must be {{#limit}} words or fewer',
  // Nested fields use component title

  objectRequired: joi.expression('Enter {{#label}}', opts),
  objectMissing: joi.expression('{{#title}} must include a {{lowerFirst(#label)}}', opts),
  dateFormat: '{{#title}} must be a real date',
  dateMin: '{{#title}} must be the same as or after {{#limit}}',
  dateMax: '{{#title}} must be the same as or before {{#limit}}',
  arrayMin: 'Select at least {{#limit}} options from the list',
  arrayMax: 'Only {{#limit}} can be selected from the list',
  arrayLength: 'Select only {{#limit}} options from the list',
  featuresMin: 'Define at least {{#limit}} features',
  featuresMax: 'Only {{#limit}} features can be defined',
  featuresLength: 'Define exactly {{#limit}} features'
};
export const messages = {
  'string.base': messageTemplate.required,
  'string.min': messageTemplate.min,
  'string.empty': messageTemplate.required,
  'string.max': messageTemplate.max,
  'string.email': messageTemplate.format,
  'string.unicode': messageTemplate.unicode,
  'string.pattern.base': messageTemplate.pattern,
  'string.maxWords': messageTemplate.maxWords,
  'number.base': messageTemplate.number,
  'number.precision': messageTemplate.numberPrecision,
  'number.integer': messageTemplate.numberInteger,
  'number.unsafe': messageTemplate.format,
  'number.min': messageTemplate.numberMin,
  'number.max': messageTemplate.numberMax,
  'object.required': messageTemplate.objectRequired,
  'object.and': messageTemplate.objectMissing,
  'any.only': messageTemplate.selectRequired,
  'any.required': messageTemplate.selectRequired,
  'any.empty': messageTemplate.required,
  'date.base': messageTemplate.dateFormat,
  'date.format': messageTemplate.dateFormat,
  'date.min': messageTemplate.dateMin,
  'date.max': messageTemplate.dateMax,
  'object.invalidjson': messageTemplate.format
};
export const messagesPre = messages;
export const validationOptions = {
  abortEarly: false,
  messages: messagesPre,
  errors: {
    wrap: {
      array: false,
      label: false
    }
  }
};
//# sourceMappingURL=validationOptions.js.map