{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://civicdataforge.pages.dev/schemas/property-market-evidence-input-v1.schema.json",
  "title": "CivicDataForge authorized property-market evidence input v1",
  "description": "A normalized market record bound to one delivered property record. Credentials are prohibited. Authorization is caller-attested and remains subject to provider terms; CivicDataForge does not independently verify the license.",
  "type": "object",
  "additionalProperties": false,
  "required": ["scope", "property_id", "currency", "provider", "provider_record_id", "observed_at", "rights", "facts"],
  "properties": {
    "scope": {"const": "PROPERTY_RECORD"},
    "property_id": {"type": "string", "minLength": 1, "maxLength": 160},
    "currency": {"type": "string", "pattern": "^[A-Z]{3}$"},
    "provider": {"type": "string", "minLength": 1, "maxLength": 120},
    "provider_record_id": {"type": "string", "minLength": 1, "maxLength": 160},
    "dataset": {"type": "string", "maxLength": 160},
    "source_url": {"type": "string", "format": "uri", "pattern": "^https://", "maxLength": 500},
    "observed_at": {"type": "string", "format": "date-time"},
    "expected_cadence": {"type": "string", "maxLength": 80},
    "rights": {
      "type": "object", "additionalProperties": false,
      "required": ["authorization_state", "scope"],
      "properties": {
        "authorization_state": {"const": "CALLER_ATTESTED"},
        "scope": {"type": "string", "minLength": 1, "maxLength": 300},
        "basis": {"type": "string", "maxLength": 300},
        "expires_at": {"type": "string", "format": "date-time"},
        "commercial_redistribution": {"type": "string", "maxLength": 80}
      }
    },
    "facts": {
      "type": "object", "additionalProperties": false, "minProperties": 1,
      "properties": {
        "listed_for_sale": {"type": "boolean"}, "sale_list_price": {"type": "number", "minimum": 0},
        "days_on_market": {"type": "number", "minimum": 0}, "listed_for_rent": {"type": "boolean"},
        "asking_rent": {"type": "number", "minimum": 0}, "market_value": {"type": "number", "minimum": 0},
        "valuation_date": {"type": "string", "format": "date-time"}, "listing_status": {"type": "string", "maxLength": 240},
        "listing_updated_at": {"type": "string", "format": "date-time"}
      }
    }
  }
}
