-- Staging model: Financial benchmarking data from FBIT API

with source as (
    select * from {{ source('raw', 'fbit_finance') }}
),

renamed as (
    select
        cast(urn as integer)                    as urn,
        cast(year as integer)                   as year,
        cast(per_pupil_spend as numeric)        as per_pupil_spend,
        cast(staff_cost_pct as numeric)         as staff_cost_pct,
        cast(teacher_cost_pct as numeric)       as teacher_cost_pct,
        cast(support_staff_cost_pct as numeric) as support_staff_cost_pct,
        cast(premises_cost_pct as numeric)      as premises_cost_pct
    from source
    where urn is not null
)

select * from renamed
