-- Staged CMHC rental market survey data
-- Source: fact_rentals table loaded from CMHC CSV exports
-- Grain: One row per zone per bedroom type per survey year

with source as (
    select * from {{ source('toronto_housing', 'fact_rentals') }}
),

staged as (
    select
        id as rental_id,
        date_key,
        zone_key,
        bedroom_type,
        universe as rental_universe,
        avg_rent,
        median_rent,
        vacancy_rate,
        availability_rate,
        turnover_rate,
        rent_change_pct as year_over_year_rent_change,
        reliability_code
    from source
)

select * from staged
