{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nisebookings-com/json-schema/nisebookings-com-package-overview-schema.json",
  "title": "PackageOverview",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/guide-openapi.json#/components/schemas/PackageOverview",
  "type": "object",
  "required": [
    "service",
    "packageTitle",
    "staff",
    "size",
    "used",
    "remaining",
    "expiresOn",
    "firstName",
    "visits"
  ],
  "properties": {
    "service": {
      "type": "object",
      "required": [
        "id",
        "title",
        "duration"
      ],
      "description": "The base service a visit books; its intake questions are what a visit must answer.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "title": {
          "type": "string"
        },
        "duration": {
          "type": "integer"
        },
        "fields": {
          "type": "array",
          "description": "The intake questions a visit must answer",
          "same shape as in GET services.": null,
          "items": {
            "$ref": "#/$defs/Field"
          }
        }
      }
    },
    "packageTitle": {
      "type": "string"
    },
    "staff": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "required": [
            "id",
            "name"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string"
            }
          }
        }
      ]
    },
    "size": {
      "type": "integer"
    },
    "used": {
      "type": "integer"
    },
    "remaining": {
      "type": "integer"
    },
    "expiresOn": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "null = not started or unlimited."
    },
    "firstName": {
      "type": "string"
    },
    "visits": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "start",
          "status"
        ],
        "properties": {
          "start": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "Field": {
      "type": "object",
      "required": [
        "id",
        "label",
        "kind",
        "required",
        "perPerson",
        "options"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "label": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "text",
            "textarea",
            "select",
            "checkbox",
            "number",
            "date",
            "file"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "perPerson": {
          "type": "boolean",
          "description": "One answer per person."
        },
        "options": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Select only; the answer must be one of these."
        },
        "showIf": {
          "type": [
            "object",
            "null"
          ],
          "description": "Ask this question only while the referenced earlier answer equals `is` (trimmed; a checkbox is \"true\"/\"false\"). A question whose condition fails is not required and an answer sent for it is dropped.",
          "required": [
            "field",
            "is"
          ],
          "properties": {
            "field": {
              "type": "string",
              "format": "uuid",
              "description": "An earlier",
              "unconditional": null,
              "non-per-person question of the same service.": null
            },
            "is": {
              "type": "string",
              "maxLength": 100
            }
          }
        }
      }
    }
  }
}