/** @since 5.0 */
export interface JSONLoaderOptions {
  /**
   * Used to calculate the relative path of the file to load.
   *
   * @since 5.0
   */
  base?: string;
  /**
   * Used to check if the loader should be used to load a candidate's message bundle.
   *
   * @since 5.0
   */
  pattern: string | RegExp;
  /**
   * The location of the translation files.
   * It can be either a `string` or `URL` pointing to the folder where the files are located, or
   * a function called with a specified path. The function should return the final path.
   *
   * @since 5.0
   */
  location: string | URL | LocationFunction;
}

/**
 * The function responsible for fetching a message bundle resource for a particular locale.
 *
 * @param path - The path.
 * @returns The location path
 * @since 4.18
 * @see [createJSONLoader()](https://developers.arcgis.com/javascript/latest/api-reference/esri-intl.html#createJSONLoader)
 */
export type LocationFunction = (path: string) => string;