{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/casatoo-pt/json-schema/casatoo-pt-listing-out-schema.json",
  "title": "ListingOut",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/casatoo-pt-openapi.yml#/components/schemas/ListingOut",
  "properties": {
    "agency_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "condition": {
      "type": [
        "string",
        "null"
      ]
    },
    "construction_year": {
      "format": "int32",
      "type": [
        "integer",
        "null"
      ]
    },
    "coordinate_precision": {
      "$ref": "#/$defs/CoordinatePrecision"
    },
    "coordinate_source": {
      "$ref": "#/$defs/CoordinateSource"
    },
    "description": {
      "type": "string"
    },
    "external_agency_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "external_id": {
      "type": "string"
    },
    "external_reference_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "floor": {
      "format": "int32",
      "type": [
        "integer",
        "null"
      ]
    },
    "gross_area": {
      "format": "int32",
      "type": "integer"
    },
    "has_approved_project": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "has_elevator": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "has_parking": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "id": {
      "format": "uuid",
      "type": "string"
    },
    "images": {
      "items": {
        "$ref": "#/$defs/ImageInfo"
      },
      "type": "array"
    },
    "is_out_of_market": {
      "type": "boolean"
    },
    "last_seen_at": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "lat": {
      "format": "double",
      "type": "number"
    },
    "lon": {
      "format": "double",
      "type": "number"
    },
    "n_rooms": {
      "format": "int32",
      "type": "integer"
    },
    "plot_area": {
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "plot_zoning": {
      "anyOf": [
        {
          "enum": [
            "urban",
            "urbanizable",
            "non_urbanizable",
            "rustic",
            "mixed",
            "industrial",
            "commercial",
            "for_construction"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "prediction": {
      "anyOf": [
        {
          "properties": {
            "calibration_version": {
              "type": [
                "string",
                "null"
              ]
            },
            "eligibility_status": {
              "type": "string"
            },
            "evidence_tier": {
              "type": "string"
            },
            "exclusion_reasons": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "interval_level": {
              "format": "double",
              "type": [
                "number",
                "null"
              ]
            },
            "lower_bound": {
              "format": "double",
              "type": [
                "number",
                "null"
              ]
            },
            "model_version": {
              "type": "string"
            },
            "point_estimate": {
              "format": "double",
              "type": [
                "number",
                "null"
              ]
            },
            "predicted_at": {
              "format": "date-time",
              "type": "string"
            },
            "upper_bound": {
              "format": "double",
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "point_estimate",
            "lower_bound",
            "upper_bound",
            "interval_level",
            "model_version",
            "calibration_version",
            "predicted_at",
            "eligibility_status",
            "exclusion_reasons",
            "evidence_tier"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "format": "double",
      "type": "number"
    },
    "price_position_level": {
      "anyOf": [
        {
          "enum": [
            "strong_low",
            "low",
            "typical",
            "high",
            "strong_high"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "price_position_score": {
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "price_vs_estimate_pct": {
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "property_type": {
      "$ref": "#/$defs/PropertyType"
    },
    "publish_date": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "$ref": "#/$defs/ListingSource"
    },
    "status": {
      "$ref": "#/$defs/ListingStatus"
    },
    "title": {
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "title",
    "description",
    "price",
    "n_rooms",
    "floor",
    "gross_area",
    "plot_area",
    "has_parking",
    "has_elevator",
    "has_approved_project",
    "images",
    "lat",
    "lon",
    "coordinate_precision",
    "coordinate_source",
    "property_type",
    "condition",
    "construction_year",
    "publish_date",
    "url",
    "source",
    "external_id",
    "status",
    "external_reference_id",
    "external_agency_url",
    "agency_name",
    "last_seen_at",
    "is_out_of_market"
  ],
  "type": "object",
  "$defs": {
    "CoordinatePrecision": {
      "enum": [
        "exact",
        "source_approximate",
        "parish_randomized",
        "municipality_randomized"
      ],
      "type": "string"
    },
    "CoordinateSource": {
      "enum": [
        "source",
        "generated"
      ],
      "type": "string"
    },
    "ImageInfo": {
      "properties": {
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "url",
        "title"
      ],
      "type": "object"
    },
    "ListingSource": {
      "enum": [
        "idealista",
        "imovirtual",
        "engelvoelkers",
        "kwportugal",
        "remax",
        "era",
        "ego",
        "casayes",
        "zome",
        "ximo",
        "hcpro",
        "proppy",
        "casafari",
        "iad"
      ],
      "type": "string"
    },
    "ListingStatus": {
      "enum": [
        "available",
        "offline"
      ],
      "type": "string"
    },
    "PropertyType": {
      "enum": [
        "apartment",
        "loft",
        "duplex",
        "house_semi_detached",
        "house_detached",
        "townhouse",
        "mansion",
        "rustic_house",
        "manor_house",
        "building",
        "plot",
        "commercial",
        "industrial",
        "storage",
        "hotel",
        "warehouse",
        "room",
        "garage",
        "other",
        "country_estate"
      ],
      "type": "string"
    }
  }
}