{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alto-vebra/json-schema/alto-vebra-lead-paged-response-schema.json",
  "title": "LeadPagedResponse",
  "description": "Represents a paged response containing metadata and a collection of items.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alto-vebra-leads-api-openapi.yml#/components/schemas/LeadPagedResponse",
  "type": "object",
  "properties": {
    "meta": {
      "allOf": [
        {
          "$ref": "#/$defs/Meta"
        }
      ],
      "description": "The metadata for the response."
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/Lead"
      },
      "description": "The collection of items in the response."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Contact": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The unique identifier of the contact"
        },
        "links": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Link"
          },
          "description": "Links to related contact."
        }
      },
      "additionalProperties": false,
      "description": "A contact that has been associated to the lead; if no contact has been associated to a lead, then will return null"
    },
    "EnquirerAddress": {
      "type": "object",
      "properties": {
        "houseName": {
          "type": [
            "string",
            "null"
          ],
          "description": "The house or flat name of the enquirer's address"
        },
        "houseNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "The house or flat number of the enquirer's address"
        },
        "street": {
          "type": [
            "string",
            "null"
          ],
          "description": "The street of the enquirer's address"
        },
        "locality": {
          "type": [
            "string",
            "null"
          ],
          "description": "The locality of the enquirer's address"
        },
        "area": {
          "type": [
            "string",
            "null"
          ],
          "description": "The area of the enquirer's address"
        },
        "town": {
          "type": [
            "string",
            "null"
          ],
          "description": "The town or city of the enquirer's address"
        },
        "county": {
          "type": [
            "string",
            "null"
          ],
          "description": "The county of the enquirer's address"
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "The country of the enquirer's address"
        },
        "postcode": {
          "type": [
            "string",
            "null"
          ],
          "description": "The postal code of the enquirer's addres"
        }
      },
      "additionalProperties": false,
      "description": "Represents a physical address of the enqurier"
    },
    "EnquirerDetails": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "The formal title of the enquirer"
        },
        "forename": {
          "type": [
            "string",
            "null"
          ],
          "description": "The first or given name of the enquirer"
        },
        "surname": {
          "type": [
            "string",
            "null"
          ],
          "description": "The surname of the enquirer"
        },
        "phoneNumberDay": {
          "type": [
            "string",
            "null"
          ],
          "description": "The day time phone number of the enquirer"
        },
        "phoneNumberEve": {
          "type": [
            "string",
            "null"
          ],
          "description": "The evening phone number of the enquirer"
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "description": "The email address of the enquirer"
        },
        "address": {
          "allOf": [
            {
              "$ref": "#/$defs/EnquirerAddress"
            }
          ],
          "description": "Represents a physical address of the enqurier"
        }
      },
      "additionalProperties": false,
      "description": "The lead's enquirer contact details that have been submitted as part of the enquiry;"
    },
    "EnquiryType": {
      "enum": [
        "Unspecified",
        "LookingToBuy",
        "LookingToLet",
        "LookingToRent",
        "LookingToSell",
        "Other"
      ],
      "type": "string"
    },
    "Lead": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The unique identifier of the lead"
        },
        "branchId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The identifier of the branch the lead belongs to"
        },
        "leadStatus": {
          "allOf": [
            {
              "$ref": "#/$defs/LeadStatus"
            }
          ],
          "description": "The processing state of the lead"
        },
        "leadSource": {
          "allOf": [
            {
              "$ref": "#/$defs/LeadSource"
            }
          ],
          "description": "The denotes where the lead's enquiry was submitted"
        },
        "enquiryDate": {
          "type": "string",
          "description": "The date and time in ISO 8601 format that the lead enquired",
          "format": "date-time"
        },
        "createdDate": {
          "type": "string",
          "description": "The date and time in ISO 8601 format that the lead was imported into Alto eg. the status of the lead has changed to \"Processed\"",
          "format": "date-time"
        },
        "modifiedDate": {
          "type": "string",
          "description": "The date and time in ISO 8601 format that the lead was last modified eg. the status of the lead has changed from \"Processed\" to \"Accepted\"",
          "format": "date-time"
        },
        "enquiryType": {
          "allOf": [
            {
              "$ref": "#/$defs/EnquiryType"
            }
          ],
          "description": "The type of enquiry the lead has made"
        },
        "enquirerDetails": {
          "allOf": [
            {
              "$ref": "#/$defs/EnquirerDetails"
            }
          ],
          "description": "The lead's enquirer contact details that have been submitted as part of the enquiry;"
        },
        "contact": {
          "allOf": [
            {
              "$ref": "#/$defs/Contact"
            }
          ],
          "description": "A contact that has been associated to the lead; if no contact has been associated to a lead, then will return null"
        },
        "properties": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Property"
          },
          "description": "A collection of properties that the lead has enquired against; if no properties have been enquired against, then returns an empty collection"
        },
        "comment": {
          "type": [
            "string",
            "null"
          ],
          "description": "Comment or note for the lead"
        }
      },
      "additionalProperties": false
    },
    "LeadSource": {
      "enum": [
        "Unspecified",
        "Agent",
        "RightMove",
        "Vebra",
        "Zoopla",
        "Api",
        "ZooplaAdReachExpress",
        "ZooplaAudienceConnect"
      ],
      "type": "string"
    },
    "LeadStatus": {
      "enum": [
        "Unspecified",
        "Unprocessed",
        "Processed",
        "Rejected",
        "Accepted"
      ],
      "type": "string"
    },
    "Link": {
      "type": "object",
      "properties": {
        "href": {
          "type": [
            "string",
            "null"
          ]
        },
        "rel": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "Meta": {
      "type": "object",
      "properties": {
        "nextToken": {
          "type": [
            "string",
            "null"
          ]
        },
        "previousToken": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "Property": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The unique identifier of the property"
        },
        "links": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Link"
          },
          "description": "Links to related property."
        }
      },
      "additionalProperties": false
    }
  }
}