{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nogpets-com/json-schema/nogpets-com-biz-visit-request-schema.json",
  "title": "BizVisitRequest",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nogpets-com-openapi.json#/components/schemas/BizVisitRequest",
  "type": "object",
  "required": [
    "category",
    "pets",
    "start",
    "resourceId"
  ],
  "properties": {
    "bizId": {
      "$ref": "#/$defs/Id",
      "description": "Only when the person runs more than one business (WHICH_BUSINESS lists them)."
    },
    "clientId": {
      "type": "string",
      "description": "An existing client (find_client)."
    },
    "client": {
      "type": "object",
      "required": [
        "name",
        "phone"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "phone": {
          "type": "string",
          "minLength": 6,
          "maxLength": 30
        },
        "email": {
          "type": "string",
          "maxLength": 254
        }
      },
      "additionalProperties": false
    },
    "consentNote": {
      "type": "string",
      "description": "New client: how they agreed to be booked and to their details being kept, in the person's words.",
      "maxLength": 500
    },
    "category": {
      "$ref": "#/$defs/Category"
    },
    "pets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "petKey": {
            "type": "string",
            "description": "A known pet of the client (get_client)."
          },
          "name": {
            "type": "string",
            "description": "A new pet's name.",
            "minLength": 1,
            "maxLength": 60
          },
          "type": {
            "$ref": "#/$defs/PetType"
          },
          "weightKg": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 120
          },
          "coat": {
            "$ref": "#/$defs/Coat"
          },
          "serviceIds": {
            "$ref": "#/$defs/ServiceIds",
            "description": "The business's service ids (list_business_services); for a known pet, left out = their usual."
          }
        },
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 6
    },
    "addressKey": {
      "type": "string",
      "description": "One of the client's addresses (get_client)."
    },
    "address": {
      "type": "object",
      "required": [
        "line1"
      ],
      "properties": {
        "label": {
          "type": "string",
          "maxLength": 40
        },
        "line1": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "suburb": {
          "type": "string",
          "maxLength": 80
        },
        "postalCode": {
          "type": "string",
          "maxLength": 12
        },
        "notes": {
          "type": "string",
          "description": "Gate code, parking.",
          "maxLength": 300
        },
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lng": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "additionalProperties": false
    },
    "start": {
      "type": "string",
      "description": "From find_business_times (ISO).",
      "format": "date-time"
    },
    "resourceId": {
      "$ref": "#/$defs/Id"
    },
    "paymentMethod": {
      "type": "string",
      "enum": [
        "CASH",
        "CARD"
      ],
      "description": "CASH on the day, or CARD: a Payfast link for the client."
    },
    "notes": {
      "type": "string",
      "maxLength": 1000
    },
    "confirm": {
      "type": "boolean",
      "description": "true only after the person saw the summary from the first call and said yes."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Category": {
      "type": "string",
      "pattern": "^[a-z0-9_-]{1,40}$",
      "description": "A service line id: grooming, walking or sitting."
    },
    "Coat": {
      "type": "string",
      "enum": [
        "SHORT",
        "MEDIUM",
        "LONG"
      ]
    },
    "Id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,128}$"
    },
    "PetType": {
      "type": "string",
      "enum": [
        "DOG",
        "CAT"
      ]
    },
    "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."
    }
  }
}