﻿/*
 * Validation messages used throughout SLSL site. 
 *
 * One option here is to add in one additional level of object, starting with the field-name and containing fields for 
 * each possible error code. For example: validationMsgs.email.INVALID_FORMAT, validationMsgs.email.MISSING_FIELD, etc
 * 
 * Or the other way around...also using a templating/substitution strategy 
 *
 * These fields are not addressed here: batchId, userId, imgId, videoId, add-dedication, ageCheck, remember-me, selected-affiliate, rs
 * 
 * These conditions (and err msgs) are not in use yet: emailPendingVerification
 * 
 * Image upload & video upload break the solution below.
 *
 * Using jQuery Templates to make this work. call $.template('templateName', markup), and then call $.tmpl('templateName', obj), for example:
 *
 *      $.template('errMsgTemplate',validationMsgs.INVALID_FORMAT['baseMsg']);
 *      $.tmpl('errMsgTemplate', {field: validationMsgs.INVALID_FORMAT['email-confirm']}) 
 *
 * PROBLEMS with the 2-part lid code form. if step-1 of the form is invalid, we don't get the server validation errors until 
 * after the form is submitted and step-1 is hidden.
 *
 * Seems like server is not validating zip-code                   
*/
var validationMsgs = {
  'INVALID_FORMAT': {
    'baseMsg': '<span>Please enter a valid ${field}.</span>',
    'email': 'email', 
    'email-confirm': 'email', 
    'lid-0': 'lid code', 'lid-1': 'lid code', 'lid-2': 'lid code', 'lid-3': 'lid code', 'lid-4': 'lid code', 'lid-5': 'lid code', 
    'lid-6': 'lid code', 'lid-7': 'lid code', 'lid-8': 'lid code', 'lid-9': 'lid code', 'lid-10': 'lid code', 'lid-11': 'lid code', 
    'lid-12': 'lid code', 'lid-13': 'lid code', 'lid-14': 'lid code', 'lid-15': 'lid code', 'lid-16': 'lid code', 'lid-17': 'lid code', 
    'lid-18': 'lid code', 'lid-19': 'lid code', 'lid-20': 'lid code', 'lid-21': 'lid code', 'lid-22': 'lid code', 'lid-23': 'lid code', 
    'lid-24': 'lid code',
    'promo-code': 'promo code',
    'zip-code': 'zip code',
    'selected-affiliate': '',
    'age': 'age',
    'img-upload': '',
    'first-name': 'first name',
    'city': 'city',
    'states': 'state',
    'dedication': 'dedication'
  },
  'MISSING_FIELD': {
    'baseMsg': '<span>Please enter a valid ${field}.</span>',
    'email': 'email', 
    'email-confirm': 'email', 
    'remember-me': '',
    'email-confirm': '',
    'lid-0': 'lid code', 'lid-1': 'lid code', 'lid-2': 'lid code', 'lid-3': 'lid code', 'lid-4': 'lid code', 'lid-5': 'lid code', 
    'lid-6': 'lid code', 'lid-7': 'lid code', 'lid-8': 'lid code', 'lid-9': 'lid code', 'lid-10': 'lid code', 'lid-11': 'lid code', 
    'lid-12': 'lid code', 'lid-13': 'lid code', 'lid-14': 'lid code', 'lid-15': 'lid code', 'lid-16': 'lid code', 'lid-17': 'lid code', 
    'lid-18': 'lid code', 'lid-19': 'lid code', 'lid-20': 'lid code', 'lid-21': 'lid code', 'lid-22': 'lid code', 'lid-23': 'lid code', 
    'lid-24': 'lid code',
    'promo-code': 'promo code',
    'zip-code': 'zip code',
    'age': 'age',
    'first-name': 'first name',
    'city': 'city',
    'states': 'state',
    'dedication': 'dedication',
    'img-upload': 'image',
    'vid-upload': 'video',
    'agree': 'agreement confirmation'
  },
  'NO_MACTH': {
    'baseMsg': '<span>The email addresses you’ve entered don’t match. Please re-enter your email address.</span>',
    'email-confirm': ''
  },
  'emailPendingVerification': '<span>Error –pending email verification. Multiple first time submissions are not allowed. Link is provided to re-enter verification email.</span>',
  'INVALID_LID_CODE': {
    'baseMsg': '<span>Please enter a valid ${field}.</span>',
    'lid-0': 'lid code', 'lid-1': 'lid code', 'lid-2': 'lid code', 'lid-3': 'lid code', 'lid-4': 'lid code', 'lid-5': 'lid code', 
    'lid-6': 'lid code', 'lid-7': 'lid code', 'lid-8': 'lid code', 'lid-9': 'lid code', 'lid-10': 'lid code', 'lid-11': 'lid code', 
    'lid-12': 'lid code', 'lid-13': 'lid code', 'lid-14': 'lid code', 'lid-15': 'lid code', 'lid-16': 'lid code', 'lid-17': 'lid code', 
    'lid-18': 'lid code', 'lid-19': 'lid code', 'lid-20': 'lid code', 'lid-21': 'lid code', 'lid-22': 'lid code', 'lid-23': 'lid code', 
    'lid-24': 'lid code'
  },
  'atLeastOneCode': {
    'baseMsg': '<span>Please enter a valid lid code.</span>'
  },
  'FILE_TOO_LARGE': {
    'baseMsg': '<span>The file was too large. Please choose a different file.</span>'
  },
  'INVALID_CONTENT_TYPE': {
    'baseMsg': '<span>The file was not an image or video. Please choose a different file.</span>'
  },
  'INVALID_PROMO_CODE': {
    'baseMsg': '<span>Please enter a valid promo code.</span>'
  },
  'MISSING_FIELD': {
    'baseMsg': '<span>Please enter a valid lid code.</span>'
  },
  'EXTERNAL_SERVICE_ERROR': {
    'baseMsg': '<span>The remote server could not be contacted. Please try again later.</span>'
  },
  'INVALID_REQUEST': {
    'baseMsg': ''
  },
  'NO_INPUT': {
    'baseMsg': ''
  },
  'NOT_FOUND': {
    'baseMsg': ''
  },
  'SERVER_ERROR': {
    'baseMsg': ''
  },
  'TOO_LONG': {
    'baseMsg': ''
  },
  'TOO_SHORT': {
    'baseMsg': ''
  },
  'TOO_YOUNG': {
    'baseMsg': 'You must be at least 18 years of age to add a dedication.',
    'age': ''
  }
};

var emailSent = 'The email has been sent.';
var limitReached = 'You have reached your daily lid redemption limit of 25 lid codes. Please return tomorrow and enter more.';
