import names from "../constants/officeNames.js";

/**
 * Retrieves the adjective associated with a specific office based on its identifier.
 *
 * This function looks up an office's adjective using its identifier from a predefined list
 * of office names. If the identifier is not found or is not provided, the function can return
 * default values as specified.
 *
 * @param {string} id - The identifier for the office. This is used to lookup the corresponding adjective.
 * @param {Object} [options] - Optional parameters.
 * @param {*} [options.unknownValue=undefined] - The value to return if the adjective is not found in the list.
 * @param {*} [options.undefinedValue=undefined] - The value to return if the provided id is undefined or invalid.
 * @returns {*} The adjective associated with the given office id if found, otherwise returns the unknownValue or undefinedValue based on the situation.
 */
const getOfficeAdjective = function getOfficeAdjective(id, {
  unknownValue = undefined,
  undefinedValue = undefined
} = {}) {
  if (!id) {
    return undefinedValue;
  }
  const officeDetails = names[id];
  if (!officeDetails || !officeDetails.adjective) {
    return unknownValue;
  }
  return officeDetails.adjective;
};
export default getOfficeAdjective;