{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alto-vebra/json-schema/alto-vebra-post-lead-request-schema.json",
  "title": "PostLeadRequest",
  "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/PostLeadRequest",
  "required": [
    "branchId",
    "enquirerDetails",
    "sourceIdentifier"
  ],
  "type": "object",
  "properties": {
    "branchId": {
      "maximum": 2147483647,
      "minimum": 1,
      "type": "integer",
      "description": "Unique identifier for the Alto branch receiving the lead.",
      "format": "int32"
    },
    "enquiryType": {
      "allOf": [
        {
          "$ref": "#/$defs/EnquiryType"
        }
      ],
      "description": "Type of enquiry."
    },
    "preferredContactMethod": {
      "allOf": [
        {
          "$ref": "#/$defs/PreferredContactMethod"
        }
      ],
      "description": "The enquirer's preferred contact method."
    },
    "preferredContactTime": {
      "allOf": [
        {
          "$ref": "#/$defs/PreferredContactTime"
        }
      ],
      "description": "The enquirer's preferred contact time."
    },
    "sourceIdentifier": {
      "maxLength": 50,
      "minLength": 0,
      "type": "string",
      "description": "Unique identifier for this lead."
    },
    "enquiryDate": {
      "type": [
        "string",
        "null"
      ],
      "description": "Enquiry date.",
      "format": "date-time"
    },
    "enquirerDetails": {
      "allOf": [
        {
          "$ref": "#/$defs/EnquirerDetailsRequest"
        }
      ],
      "description": "The enquirer's contact details."
    },
    "propertyEnquiries": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/LeadPropertyEnquiry"
      },
      "description": "Collection of property enquiries"
    },
    "comment": {
      "maxLength": 2000,
      "type": [
        "string",
        "null"
      ],
      "description": "Comment from the enquirer."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "EnquirerAddressRequest": {
      "type": "object",
      "properties": {
        "houseName": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The house or flat name of the enquirer's address"
        },
        "houseNumber": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The house or flat number of the enquirer's address"
        },
        "street": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The street of the enquirer's address"
        },
        "locality": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The locality of the enquirer's address"
        },
        "area": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The area of the enquirer's address"
        },
        "town": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The town or city of the enquirer's address"
        },
        "county": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The county of the enquirer's address"
        },
        "country": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The country of the enquirer's address"
        },
        "postcode": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The postal code of the enquirer's addres"
        }
      },
      "additionalProperties": false
    },
    "EnquirerDetailsRequest": {
      "required": [
        "forename"
      ],
      "type": "object",
      "properties": {
        "title": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The formal title of the enquirer"
        },
        "forename": {
          "maxLength": 200,
          "minLength": 0,
          "type": "string",
          "description": "The first or given name of the enquirer"
        },
        "surname": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The surname of the enquirer"
        },
        "phoneNumberDay": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The day time phone number of the enquirer"
        },
        "phoneNumberEve": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The evening phone number of the enquirer"
        },
        "email": {
          "maxLength": 200,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The email address of the enquirer",
          "format": "email"
        },
        "address": {
          "allOf": [
            {
              "$ref": "#/$defs/EnquirerAddressRequest"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "EnquiryType": {
      "enum": [
        "Unspecified",
        "LookingToBuy",
        "LookingToLet",
        "LookingToRent",
        "LookingToSell",
        "Other"
      ],
      "type": "string"
    },
    "LeadPropertyEnquiry": {
      "type": "object",
      "properties": {
        "propertyId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Unique identifier of the property."
        },
        "price": {
          "type": "number",
          "description": "The price of the property.",
          "format": "double"
        },
        "postcode": {
          "type": [
            "string",
            "null"
          ],
          "description": "The postcode of the property."
        },
        "bedrooms": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The number of bedrooms.",
          "format": "int32"
        }
      },
      "additionalProperties": false
    },
    "PreferredContactMethod": {
      "enum": [
        "Unspecified",
        "Email",
        "Phone",
        "Post"
      ],
      "type": "string"
    },
    "PreferredContactTime": {
      "enum": [
        "Unspecified",
        "Afternoon",
        "Anytime",
        "Evening",
        "Morning"
      ],
      "type": "string"
    }
  }
}