{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "DayTidy Agent Access common",
  "$defs": {
    "OpaqueId": {
      "type": "string",
      "minLength": 16,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_-]+$"
    },
    "PositiveId": {
      "type": "integer",
      "minimum": 1
    },
    "Timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Offset required on input; normalize responses to UTC. Booking selection and query bounds use whole-second precision. Cross-field range validation is mandatory."
    },
    "Timezone": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Valid IANA timezone identifier; validate against the server timezone database."
    },
    "Amount": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,8})?$",
      "description": "Decimal string, using configured currency precision and existing rounding. No client-authoritative price."
    },
    "Currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "BookingStatus": {
      "type": "string",
      "enum": [
        "pending",
        "confirmed",
        "declined",
        "cancelled",
        "completed",
        "expired",
        "failed"
      ]
    },
    "PaymentStatus": {
      "type": "string",
      "enum": [
        "unpaid",
        "pending",
        "paid",
        "failed",
        "not_required",
        "refunded",
        "partially_refunded"
      ]
    },
    "FieldValues": {
      "type": "object",
      "maxProperties": 100,
      "propertyNames": {
        "pattern": "^(0|[1-9][0-9]*)$",
        "not": {
          "pattern": "[^0-9]"
        }
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string",
            "maxLength": 4000
          },
          {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Exact JSON integer in the RFC 8785 interoperability range. Validate before lossy parsing or casting. Do not coerce numeric strings into numbers."
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 1000
            },
            "maxItems": 100
          }
        ]
      },
      "description": "Keys are the exact decimal strings of published nonnegative form-field IDs, without leading zeros. The offering field definitions additionally validate values. No file, raw-card or identity-override fields."
    },
    "Page": {
      "type": "object",
      "properties": {
        "next_cursor": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 512
        }
      },
      "required": [
        "next_cursor"
      ],
      "additionalProperties": false,
      "description": "Cursor binds the site, operation, effective locale, normalized filters, page size and sort order. Null ends pagination."
    },
    "NextAction": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "none",
            "approval_required",
            "checkout_required",
            "browser_required"
          ]
        },
        "url": {
          "$ref": "common.json#/$defs/FirstPartyUrl"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "enum": [
                  "checkout_required",
                  "browser_required"
                ]
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "required": [
              "url"
            ]
          }
        }
      ]
    },
    "BookingQuantity": {
      "type": "integer",
      "minimum": 1,
      "description": "Validate against current offering/option min/max, capacity and Appointments::quantityLimit where applicable. No fixed transport ceiling; reject values not representable by the supported runtime before expansion."
    },
    "SeatCount": {
      "type": "integer",
      "minimum": 1,
      "description": "Must match the engine-derived seat count for the configured option and requested quantity. No fixed transport ceiling."
    },
    "AppointmentMode": {
      "type": "string",
      "enum": [
        "separate",
        "same_time",
        "back_to_back"
      ],
      "description": "Existing independent-appointment matching mode. Normalize through the shared Draft/Appointments rules before quoting and approval binding."
    },
    "RequestId": {
      "type": "string",
      "minLength": 16,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_-]+$",
      "description": "Server-generated opaque trace identifier, identical in X-Request-ID and a top-level business error body. Never a credential or a client-supplied authority.",
      "not": {
        "pattern": "[^A-Za-z0-9_-]"
      }
    },
    "FirstPartyUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048,
      "pattern": "^https://[^/?#@\\s]+(?:[/?#]|$)",
      "x-url-origin": "canonical site origin",
      "description": "Server-generated HTTPS URL without userinfo; additionally require the canonical site origin using trusted site context. Never trust an agent-provided origin or include credentials in its query."
    },
    "PublicResource": {
      "type": "object",
      "properties": {
        "resource_id": {
          "$ref": "common.json#/$defs/PositiveId"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        }
      },
      "required": [
        "resource_id",
        "label"
      ],
      "additionalProperties": false,
      "description": "Only the resource entity ID and browser-visible name/label for an eligible, active customer-selectable resource. Never serialize a Resource entity or WordPress staff/user IDs."
    },
    "ParticipantRowId": {
      "type": "string",
      "pattern": "^(option|appointment)-[1-9][0-9]*-[1-9][0-9]*$",
      "maxLength": 64,
      "not": {
        "pattern": "[^a-z0-9-]"
      },
      "description": "Server-issued, quote-scoped identifier for one option unit or independent appointment. The prefix distinguishes the two modes."
    }
  }
}
