{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/highlevel/json-schema/highlevel-create-schedule-dto-schema.json",
  "title": "CreateScheduleDTO",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/highlevel-availability-api-openapi.yml#/components/schemas/CreateScheduleDTO",
  "type": "object",
  "properties": {
    "rules": {
      "description": "Schedule rules defining when the schedule is active",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ScheduleRuleDTO"
      }
    },
    "timezone": {
      "type": "string",
      "description": "Timezone for the schedule (IANA timezone identifier)",
      "pattern": "^[A-Za-z_]+/[A-Za-z_]+$"
    },
    "locationId": {
      "type": "string",
      "description": "Location ID where this schedule applies"
    },
    "name": {
      "type": "string",
      "description": "Human-readable name for the schedule"
    },
    "userId": {
      "type": "string",
      "description": "User ID associated with the schedule"
    },
    "calendarIds": {
      "description": "Calendar IDs associated with the schedule",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "timezone",
    "locationId",
    "name",
    "userId"
  ],
  "$defs": {
    "ScheduleIntervalDTO": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "description": "Start time in HH:MM format (24-hour format)",
          "pattern": "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"
        },
        "to": {
          "type": "string",
          "description": "End time in HH:MM format (24-hour format)",
          "pattern": "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "ScheduleRuleDTO": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "wday",
            "date"
          ],
          "description": "Type of schedule rule - weekday (recurring) or date (specific date)"
        },
        "intervals": {
          "description": "Time intervals for the rule (e.g., 9 AM to 5 PM)",
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScheduleIntervalDTO"
          }
        },
        "date": {
          "type": "string",
          "description": "Specific date in YYYY-MM-DD format (only for date-type rules)",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "day": {
          "type": "string",
          "enum": [
            "sunday",
            "monday",
            "tuesday",
            "wednesday",
            "thursday",
            "friday",
            "saturday"
          ],
          "description": "Day of week (only for weekday-type rules)"
        }
      },
      "required": [
        "type",
        "intervals"
      ]
    }
  }
}