{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://civicdataforge.pages.dev/schemas/property-enrichment-request-v1.schema.json",
  "title": "CivicDataForge Property Enrichment Request v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["session_id", "provider", "dataset", "rights", "records"],
  "properties": {
    "session_id": {"type": "string", "pattern": "^cs_[A-Za-z0-9_]{12,220}$", "description": "Private successful checkout-session reference. It is used for access control and omitted from the response."},
    "provider": {"type": "string", "minLength": 1, "maxLength": 120},
    "dataset": {"type": "string", "minLength": 1, "maxLength": 160},
    "rights": {"type": "object", "additionalProperties": false, "required": ["authorization_state", "scope"], "properties": {"authorization_state": {"const": "CALLER_ATTESTED"}, "scope": {"type": "string", "minLength": 1, "maxLength": 300}, "commercial_redistribution": {"type": "string", "maxLength": 80}}},
    "records": {"type": "array", "minItems": 1, "maxItems": 25, "items": {"type": "object", "additionalProperties": false, "required": ["property_id", "provider_record_id", "observed_at", "facts"], "properties": {"property_id": {"type": "string", "minLength": 1, "maxLength": 160}, "provider_record_id": {"type": "string", "minLength": 1, "maxLength": 160}, "observed_at": {"type": "string", "format": "date-time"}, "facts": {"type": "object", "maxProperties": 50, "propertyNames": {"pattern": "^(property\\.(parcel_id|assessed_value|assessed_value_year|assessor_implied_market_value|market_value|land_market_value|building_market_value|taxable_value|latest_public_sale_price|latest_public_sale_date|tax_code|property_tax_rate|property_tax_bill|property_tax_year|listed_for_sale|sale_list_price|listed_for_rent|asking_rent|achieved_rent|cost_basis|building_area_sqft|bedrooms|full_bathrooms|year_built|fema_special_flood_hazard_area|zoning_code|pool|latitude|longitude|publisher_last_edited_at)|permit\\.(permit_ids|published_statuses|expiration_dates|matched_addresses|match_status|scope_completeness))$"}, "additionalProperties": {"type": ["string", "number", "boolean", "null"]}}}}}
  }
}
