import { LocationFieldBase } from "./LocationFieldBase.js";
import { createLowerFirstExpression } from "./helpers/index.js";
export class NationalGridFieldNumberField extends LocationFieldBase {
  getValidationConfig() {
    // Regex for OS national grid field references (NGFR)
    // Validates specific valid OS grid letter combinations with:
    // - 2 letters & 8 digits in 2 blocks of 4 e.g. ST 6789 6789
    const pattern = /^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\s?([0-9]{4})\s?([0-9]{4})$/;
    const patternTemplate = 'Enter a valid National Grid field number for {{lowerFirst(#title)}} like NG 1234 5678';
    return {
      pattern,
      patternErrorMessage: createLowerFirstExpression(patternTemplate),
      requiredMessage: createLowerFirstExpression('Enter {{lowerFirst(#title)}}')
    };
  }
  getErrorTemplates() {
    return [{
      type: 'pattern',
      template: createLowerFirstExpression('Enter a valid National Grid field number for {{lowerFirst(#title)}} like NG 1234 5678')
    }];
  }

  /**
   * Static version of getAllPossibleErrors that doesn't require a component instance.
   */
  static getAllPossibleErrors() {
    const instance = Object.create(NationalGridFieldNumberField.prototype);
    return instance.getAllPossibleErrors();
  }
}
//# sourceMappingURL=NationalGridFieldNumberField.js.map