{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nogpets-com/json-schema/nogpets-com-book-request-schema.json",
  "title": "BookRequest",
  "description": "One visit: start and resourceId from find_times. An overnight stay: `stay`. Visits over several days: `visits`.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nogpets-com-openapi.json#/components/schemas/BookRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "category",
    "addressId",
    "pets",
    "paymentMethod"
  ],
  "properties": {
    "category": {
      "$ref": "#/$defs/Category"
    },
    "addressId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,128}$"
    },
    "pets": {
      "type": "array",
      "minItems": 1,
      "maxItems": 6,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "petId",
          "serviceIds"
        ],
        "properties": {
          "petId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "serviceIds": {
            "$ref": "#/$defs/ServiceIds"
          },
          "packageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          }
        }
      }
    },
    "start": {
      "type": "string",
      "format": "date-time",
      "description": "A slot's start from find_times, unchanged."
    },
    "resourceId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,128}$",
      "description": "The slot's resourceId, unchanged."
    },
    "paymentMethod": {
      "type": "string",
      "enum": [
        "CARD",
        "CASH"
      ]
    },
    "notes": {
      "type": "string",
      "maxLength": 1000
    },
    "repeat": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "freq",
        "days"
      ],
      "description": "Walks only. Books the weeks up to 4 weeks out now; the rest follow.",
      "properties": {
        "freq": {
          "type": "string",
          "const": "WEEKLY"
        },
        "days": {
          "type": "array",
          "minItems": 1,
          "maxItems": 7,
          "items": {
            "type": "string",
            "enum": [
              "mon",
              "tue",
              "wed",
              "thu",
              "fri",
              "sat",
              "sun"
            ]
          }
        },
        "until": {
          "oneOf": [
            {
              "$ref": "#/$defs/Date"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "confirm": {
      "type": "boolean",
      "description": "Cash only: true once the person said yes to the summary."
    },
    "stay": {
      "$ref": "#/$defs/Stay"
    },
    "visits": {
      "$ref": "#/$defs/Visits"
    },
    "promoCode": {
      "type": "string",
      "maxLength": 32,
      "description": "The code from the quote. A code that no longer applies is a 409 PROMO (details.reason). Left out, a claimed offer is applied if it fits."
    }
  },
  "$defs": {
    "Category": {
      "type": "string",
      "pattern": "^[a-z0-9_-]{1,40}$",
      "description": "A service line id: grooming, walking or sitting."
    },
    "Date": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
      "description": "A local date, YYYY-MM-DD."
    },
    "ServiceIds": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{1,128}$"
      },
      "description": "Service ids from list_services; exactly one PRIMARY plus any EXTRAs of the same line. A package id (a line's `packages`) stands for its main service and extras."
    },
    "Stay": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "startDate",
        "nights"
      ],
      "description": "An overnight stay. One booking a night, from the evening visit to the next morning's check.",
      "properties": {
        "startDate": {
          "$ref": "#/$defs/Date"
        },
        "nights": {
          "type": "integer",
          "minimum": 1,
          "maximum": 14
        },
        "eveningWindow": {
          "type": "string",
          "description": "A window id from `windows.evening` (or \"17:00-19:00\"). Default the first."
        },
        "morningWindow": {
          "type": "string",
          "description": "A window id from `windows.morning`. Default the first."
        },
        "notes": {
          "type": "string",
          "maxLength": 1000,
          "description": "Keys, feeding, meds."
        }
      }
    },
    "Visits": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "startDate",
        "days"
      ],
      "description": "Visits over several days. One booking a visit, at the first free time in its window.",
      "properties": {
        "startDate": {
          "$ref": "#/$defs/Date"
        },
        "days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 14
        },
        "perDay": {
          "type": "integer",
          "minimum": 1,
          "maximum": 3
        },
        "windows": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "type": "string"
          },
          "description": "A window id from `windows.visit` per visit of the day, in order."
        },
        "notes": {
          "type": "string",
          "maxLength": 1000
        }
      }
    }
  }
}