"use strict";
const sentryWrapper = require("./sentryWrapper-nsnkxXFH.cjs");
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 sentryWrapper.intervalLimitsType.safeParse(obj).success;
}
function parseDurationLimit(obj) {
  let durationLimit = null;
  if (isDurationLimit(obj))
    durationLimit = obj;
  return durationLimit;
}
function isBookingLimit(obj) {
  return sentryWrapper.intervalLimitsType.safeParse(obj).success;
}
function parseBookingLimit(obj) {
  let bookingLimit = null;
  if (isBookingLimit(obj))
    bookingLimit = obj;
  return bookingLimit;
}
exports.ascendingLimitKeys = ascendingLimitKeys;
exports.descendingLimitKeys = descendingLimitKeys;
exports.intervalLimitKeyToUnit = intervalLimitKeyToUnit;
exports.parseBookingLimit = parseBookingLimit;
exports.parseDurationLimit = parseDurationLimit;
