import { a7 as intervalLimitsType } from "./orgDomains-eTg-cjth.js";
const ascendingLimitKeys = ["PER_DAY", "PER_WEEK", "PER_MONTH", "PER_YEAR"];
const descendingLimitKeys = [...ascendingLimitKeys].reverse();
function isIntervalLimitUnit(value) {
  return ["day", "week", "month", "year"].includes(value);
}
function intervalLimitKeyToUnit(key) {
  const extracted = key.split("_")[1].toLowerCase();
  if (isIntervalLimitUnit(extracted))
    return extracted;
  throw new Error(`Invalid interval limit key: ${key}`);
}
function isDurationLimit(obj) {
  return intervalLimitsType.safeParse(obj).success;
}
function parseDurationLimit(obj) {
  let durationLimit = null;
  if (isDurationLimit(obj))
    durationLimit = obj;
  return durationLimit;
}
function isBookingLimit(obj) {
  return intervalLimitsType.safeParse(obj).success;
}
function parseBookingLimit(obj) {
  let bookingLimit = null;
  if (isBookingLimit(obj))
    bookingLimit = obj;
  return bookingLimit;
}
export {
  parseDurationLimit as a,
  ascendingLimitKeys as b,
  descendingLimitKeys as d,
  intervalLimitKeyToUnit as i,
  parseBookingLimit as p
};
