{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hou.realtor/schemas/intake.buyer.schema.json",
  "title": "intake.buyer",
  "description": "Start working with Tiffany as a buyer. Information and proposals only. Nothing in a request is binding: offers, contracts, earnest money, and representation agreements require Tiffany Hua's own signature. Send by email to tiffany@hou.realtor with subject '[intake.buyer] <short summary>' and the request JSON as the body; natively delivery comes once hou.realtor's entity record is published (https://hou.realtor/agent.html).",
  "type": "object",
  "required": [
    "type",
    "schema_version",
    "agent",
    "contact",
    "area",
    "timing"
  ],
  "properties": {
    "type": {
      "const": "intake.buyer"
    },
    "schema_version": {
      "const": "0.1"
    },
    "sent_at": {
      "type": "string",
      "format": "date-time"
    },
    "agent": {
      "$ref": "#/$defs/agent"
    },
    "contact": {
      "$ref": "#/$defs/contact"
    },
    "area": {
      "$ref": "#/$defs/area"
    },
    "timing": {
      "$ref": "#/$defs/timing",
      "description": "When the buyer wants to move."
    },
    "budget_usd": {
      "type": "object",
      "properties": {
        "min": {
          "type": "integer",
          "minimum": 0
        },
        "max": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "financing": {
      "enum": [
        "cash",
        "pre-approved",
        "need a lender",
        "unsure"
      ]
    },
    "bedrooms_min": {
      "type": "integer",
      "minimum": 0
    },
    "bathrooms_min": {
      "type": "number",
      "minimum": 0
    },
    "must_haves": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "buyer_represented": {
      "type": "boolean",
      "description": "true if the buyer already has a written buyer agreement with another agent."
    },
    "notes": {
      "type": "string",
      "maxLength": 2000
    }
  },
  "$defs": {
    "agent": {
      "type": "object",
      "description": "The sending agent's identity, in natively agent-card shape (https://natively.io/BOOTSTRAP.html, card fields agent_key, principal, ledger). An agent without a natively identity yet sets agent_key and ledger to null; its request is then handled as unverified information.",
      "required": [
        "agent_key",
        "principal",
        "ledger"
      ],
      "properties": {
        "agent_key": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^ed25519:[A-Za-z0-9+/]{43}=$",
          "description": "Your Ed25519 public key, 'ed25519:' + base64 of the 32 raw bytes. Never send a private key."
        },
        "principal": {
          "type": "string",
          "minLength": 1,
          "description": "Key ref of the human you act for. Until your principal has a signer, use their email address."
        },
        "ledger": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "URL of your hash-chained ledger, or null if you do not keep one yet."
        },
        "name": {
          "type": "string",
          "description": "Optional display name for the agent."
        },
        "card_url": {
          "type": "string",
          "format": "uri",
          "description": "Optional URL of your published agent card."
        }
      }
    },
    "contact": {
      "type": "object",
      "description": "The human Tiffany would reply to. Give at least an email or a phone number.",
      "required": [
        "name"
      ],
      "anyOf": [
        {
          "required": [
            "email"
          ]
        },
        {
          "required": [
            "phone"
          ]
        }
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "phone": {
          "type": "string",
          "minLength": 7
        },
        "preferred_channel": {
          "enum": [
            "email",
            "phone",
            "text",
            "natively"
          ]
        }
      }
    },
    "area": {
      "type": "object",
      "description": "Where in Texas. Give at least one of cities, neighborhoods, zip_codes, or description.",
      "anyOf": [
        {
          "required": [
            "cities"
          ]
        },
        {
          "required": [
            "neighborhoods"
          ]
        },
        {
          "required": [
            "zip_codes"
          ]
        },
        {
          "required": [
            "description"
          ]
        }
      ],
      "properties": {
        "cities": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "neighborhoods": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "zip_codes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^[0-9]{5}$"
          }
        },
        "description": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "timing": {
      "type": "object",
      "required": [
        "horizon"
      ],
      "properties": {
        "horizon": {
          "enum": [
            "asap",
            "0-3 months",
            "3-6 months",
            "6-12 months",
            "12+ months",
            "unsure"
          ]
        },
        "earliest": {
          "type": "string",
          "format": "date"
        },
        "latest": {
          "type": "string",
          "format": "date"
        }
      }
    }
  },
  "examples": [
    {
      "type": "intake.buyer",
      "schema_version": "0.1",
      "sent_at": "2026-10-21T15:00:00Z",
      "agent": {
        "agent_key": null,
        "principal": "jordan@example.com",
        "ledger": null,
        "name": "Jordan's assistant"
      },
      "contact": {
        "name": "Jordan Example",
        "email": "jordan@example.com",
        "preferred_channel": "email"
      },
      "area": {
        "cities": [
          "Sugar Land",
          "Katy"
        ]
      },
      "timing": {
        "horizon": "3-6 months"
      },
      "budget_usd": {
        "min": 350000,
        "max": 450000
      },
      "financing": "pre-approved",
      "bedrooms_min": 3
    }
  ]
}
