{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/casaintelligence-com-au/json-schema/casaintelligence-com-au-sales-search-response-schema.json",
  "title": "SalesSearchResponse",
  "description": "Response from comparable sales search.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/casaintelligence-com-au-comparable-sales-api-openapi.yml#/components/schemas/SalesSearchResponse",
  "properties": {
    "property_id": {
      "type": "string",
      "title": "Property Id"
    },
    "property_address": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Property Address"
    },
    "search_radius_m": {
      "type": "integer",
      "title": "Search Radius M"
    },
    "total_found": {
      "type": "integer",
      "title": "Total Found"
    },
    "sales": {
      "items": {
        "$ref": "#/$defs/ComparableSale"
      },
      "type": "array",
      "title": "Sales",
      "default": []
    },
    "suburb_stats": {
      "anyOf": [
        {
          "$ref": "#/$defs/SuburbSalesStats"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "property_id",
    "search_radius_m",
    "total_found"
  ],
  "$defs": {
    "ComparableSale": {
      "properties": {
        "address": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Address"
        },
        "sale_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sale Date"
        },
        "sale_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sale Price"
        },
        "land_area_m2": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Land Area M2"
        },
        "price_per_m2": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Price Per M2"
        },
        "property_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Property Type"
        },
        "distance_m": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Distance M"
        },
        "bedrooms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bedrooms"
        },
        "bathrooms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bathrooms"
        }
      },
      "type": "object",
      "title": "ComparableSale",
      "description": "A comparable sale for price fairness scoring."
    },
    "SuburbSalesStats": {
      "properties": {
        "suburb": {
          "type": "string",
          "title": "Suburb"
        },
        "lga": {
          "type": "string",
          "title": "Lga"
        },
        "property_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Property Type"
        },
        "total_sales": {
          "type": "integer",
          "title": "Total Sales",
          "default": 0
        },
        "median_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Median Price"
        },
        "avg_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Price"
        },
        "avg_price_per_m2": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Price Per M2"
        },
        "median_price_per_m2": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Median Price Per M2"
        },
        "sales_last_12m": {
          "type": "integer",
          "title": "Sales Last 12M",
          "default": 0
        },
        "annual_growth_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Annual Growth Pct"
        }
      },
      "type": "object",
      "required": [
        "suburb",
        "lga"
      ],
      "title": "SuburbSalesStats",
      "description": "Aggregated sales statistics for a suburb."
    }
  }
}