with
    stg_edeposit__verifications as (
        select * from {{ ref("stg_edeposit__verifications") }}
    ),
    stg_core__user as (select * from {{ ref("stg_core__user") }})
select
    -- note that these ids are not the same as the ones found in Core DWH
    -- they are completely unrelated
    v.id_verification,
    v.id_booking,
    v.id_user_partner,
    u.id_deal,
    v.id_accommodation,
    v.version,
    case when v.version = 'V2' then 'Edeposit' else null end as verification_source,
    v.verification_status,
    v.nightly_fee_local,
    cast(v.checkout_at_utc as date) - cast(v.checkin_at_utc as date) as number_nights,
    v.email_flag,
    v.phone_flag,
    v.watch_list,
    v.channel,
    v.checkin_at_utc,
    cast(v.checkin_at_utc as date) as checkin_date_utc,
    v.checkout_at_utc,
    cast(v.checkout_at_utc as date) as checkout_date_utc,
    v.is_cancelled,
    v.cancelled_at_utc,
    cast(v.cancelled_at_utc as date) as cancelled_date_utc,
    v.user_email,
    v.guest_email,
    v.guest_last_name,
    v.guest_first_name,
    v.guest_telephone,
    v.company_name,
    v.listing_name,
    v.listing_address,
    v.listing_town,
    v.listing_country,
    v.listing_postcode,
    v.pets_allowed,
    v.status_updated_at_utc,
    v.status_updated_date_utc,
    v.updated_at_utc,
    v.athena_creation_at_utc,
    v.athena_creation_date_utc,
    v.created_at_utc,
    v.created_date_utc
from stg_edeposit__verifications v
left join stg_core__user u on u.email = v.user_email
