version: 2

sources:
  - name: toronto_housing
    description: "Toronto housing data loaded from TRREB and CMHC sources"
    database: portfolio
    schema: public
    tables:
      - name: fact_purchases
        description: "TRREB monthly purchase/sales statistics by district"
        columns:
          - name: id
            description: "Primary key"
          - name: date_key
            description: "Foreign key to dim_time"
          - name: district_key
            description: "Foreign key to dim_trreb_district"

      - name: fact_rentals
        description: "CMHC annual rental survey data by zone and bedroom type"
        columns:
          - name: id
            description: "Primary key"
          - name: date_key
            description: "Foreign key to dim_time"
          - name: zone_key
            description: "Foreign key to dim_cmhc_zone"

      - name: dim_time
        description: "Time dimension (monthly grain)"
        columns:
          - name: date_key
            description: "Primary key (YYYYMMDD format)"

      - name: dim_trreb_district
        description: "TRREB district dimension with geometry"
        columns:
          - name: district_key
            description: "Primary key"
          - name: district_code
            description: "TRREB district code"

      - name: dim_cmhc_zone
        description: "CMHC zone dimension with geometry"
        columns:
          - name: zone_key
            description: "Primary key"
          - name: zone_code
            description: "CMHC zone code"

      - name: dim_neighbourhood
        description: "City of Toronto neighbourhoods (reference only)"
        columns:
          - name: neighbourhood_id
            description: "Primary key"

      - name: dim_policy_event
        description: "Housing policy events for annotation"
        columns:
          - name: event_id
            description: "Primary key"
