import { setResponseValueAndErrors as n } from "../errorMessages.js";
function i(a, t, r) {
  const e = r ?? t.dateStrategy;
  if (Array.isArray(e))
    return {
      anyOf: e.map((s, o) => i(a, t, s))
    };
  switch (e) {
    case "string":
    case "format:date-time":
      return {
        type: "string",
        format: "date-time"
      };
    case "format:date":
      return {
        type: "string",
        format: "date"
      };
    case "integer":
      return m(a, t);
  }
}
const m = (a, t) => {
  const r = {
    type: "integer",
    format: "unix-time"
  };
  if (t.target === "openApi3")
    return r;
  for (const e of a.checks)
    switch (e.kind) {
      case "min":
        n(
          r,
          "minimum",
          e.value,
          // This is in milliseconds
          e.message,
          t
        );
        break;
      case "max":
        n(
          r,
          "maximum",
          e.value,
          // This is in milliseconds
          e.message,
          t
        );
        break;
    }
  return r;
};
export {
  i as parseDateDef
};
//# sourceMappingURL=date.js.map
