{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alto-vebra/json-schema/alto-vebra-alto-contacts-api-models-requests-post-contact-request-schema.json",
  "title": "Alto.Contacts.Api.Models.Requests.PostContactRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alto-vebra-contacts-api-openapi.yml#/components/schemas/Alto.Contacts.Api.Models.Requests.PostContactRequest",
  "required": [
    "branchId",
    "people"
  ],
  "type": "object",
  "properties": {
    "negotiatorId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The unique identifier of the negotiator"
    },
    "branchId": {
      "minLength": 1,
      "type": "string",
      "description": "The Contact's BranchId."
    },
    "address": {
      "allOf": [
        {
          "$ref": "#/$defs/Alto.Contacts.Api.Models.Requests.Address"
        }
      ],
      "description": "The Contact's Address details."
    },
    "people": {
      "maxItems": 2,
      "minItems": 1,
      "type": "array",
      "items": {
        "$ref": "#/$defs/Alto.Contacts.Api.Models.Requests.Person"
      },
      "description": "The Person(s) on the Contact. Each Contact must have at least one Person but no more than two People."
    },
    "lead": {
      "allOf": [
        {
          "$ref": "#/$defs/Alto.Contacts.Api.Models.Requests.Lead"
        }
      ],
      "description": "This contact originated from a lead (enquiry)"
    },
    "position": {
      "type": [
        "string",
        "null"
      ],
      "description": "The position of the contact, defined as the Id for this AgencyRef chosen from /parameters/client-positions"
    },
    "intention": {
      "type": [
        "string",
        "null"
      ],
      "description": "The intention of the contact, defined as the Id for this AgencyRef chosen from /parameters/client-intentions"
    },
    "disposal": {
      "type": [
        "string",
        "null"
      ],
      "description": "The disposal of the contact, defined as the Id for this AgencyRef chosen from /parameters/client-disposal-status"
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "The notes for the contact"
    },
    "companyName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The company name associated with the contact"
    },
    "category": {
      "enum": [
        "Unknown",
        "Client",
        "ContactRelationship"
      ],
      "type": "string",
      "description": "The contact's category type"
    },
    "potentialVendor": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Indicates whether the contact is a potential vendor."
    },
    "potentialLandlord": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Indicates whether the contact is a potential landlord."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Alto.Contacts.Api.Models.Requests.Address": {
      "type": "object",
      "properties": {
        "subDwelling": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The sub-dwelling of the address, such as a flat or apartment number."
        },
        "nameNumber": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The name or number of the building or property."
        },
        "street": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The name of the street."
        },
        "locality": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The locality, such as a village or neighborhood."
        },
        "town": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The town or city of the address."
        },
        "county": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The county or region of the address."
        },
        "postcode": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The postal code of the address."
        },
        "countryCode": {
          "maxLength": 2,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The country code of the address.\nDefault if not set: GB"
        },
        "uprn": {
          "maxLength": 12,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The Unique Property Reference Number (UPRN) for the address.\nThis is an optional field for backward compatibility."
        }
      },
      "additionalProperties": false
    },
    "Alto.Contacts.Api.Models.Requests.EmailAddress": {
      "required": [
        "address"
      ],
      "type": "object",
      "properties": {
        "address": {
          "minLength": 1,
          "type": "string",
          "description": "The email address.",
          "format": "email"
        }
      },
      "additionalProperties": false
    },
    "Alto.Contacts.Api.Models.Requests.Lead": {
      "required": [
        "source"
      ],
      "type": "object",
      "properties": {
        "source": {
          "minLength": 1,
          "type": "string",
          "description": "The Id for this AgencyRef chosen from /parameters/lead-sources"
        },
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The numeric Id of the lead record that is being converted into a contact"
        }
      },
      "additionalProperties": false
    },
    "Alto.Contacts.Api.Models.Requests.Person": {
      "required": [
        "surname"
      ],
      "type": "object",
      "properties": {
        "title": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The formal title of the Person."
        },
        "forename": {
          "maxLength": 50,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ],
          "description": "The first or given name of the Person."
        },
        "surname": {
          "maxLength": 50,
          "minLength": 0,
          "type": "string",
          "description": "The surname of the Person."
        },
        "phoneNumbers": {
          "maxItems": 4,
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Alto.Contacts.Api.Models.Requests.Phone"
          },
          "description": "A list of the Person's phone numbers."
        },
        "emailAddresses": {
          "maxItems": 2,
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Alto.Contacts.Api.Models.Requests.EmailAddress"
          },
          "description": "A list of the Person's email addresses"
        }
      },
      "additionalProperties": false
    },
    "Alto.Contacts.Api.Models.Requests.Phone": {
      "required": [
        "number"
      ],
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "Unspecified",
            "Home",
            "Business",
            "Mobile",
            "Fax",
            "Work",
            "ISDN"
          ],
          "type": "string",
          "description": "The type of phone number. Default if not set: \"Home\"."
        },
        "number": {
          "minLength": 1,
          "pattern": "^[\\+]?[0-9\\s]{10,20}$",
          "type": "string",
          "description": "The telephone number for the Person."
        },
        "description": {
          "maxLength": 50,
          "type": [
            "string",
            "null"
          ],
          "description": "The description of the telephone number."
        }
      },
      "additionalProperties": false
    }
  }
}