with
    int_athena__verifications as (select * from {{ ref("int_athena__verifications") }}),
    int_edeposit__verifications as (
        select * from {{ ref("int_edeposit__verifications") }}
    )
select
    av.id_verification,
    av.id_booking,
    av.id_user_partner,
    av.id_accommodation,
    av.version,
    av.verification_source,
    av.verification_status,
    av.nightly_fee_local,
    case
        when av.number_nights = 0
        then av.nightly_fee_local
        else av.nightly_fee_local * av.number_nights
    end as total_fee_local,
    av.number_nights,
    av.email_flag,
    av.phone_flag,
    av.watch_list,
    av.channel,
    av.checkin_at_utc,
    av.checkin_date_utc,
    av.checkout_at_utc,
    av.checkout_date_utc,
    av.is_cancelled,
    av.cancelled_at_utc,
    av.cancelled_date_utc,
    av.user_email,
    av.guest_email,
    av.guest_last_name,
    av.guest_first_name,
    av.guest_telephone,
    null as company_name,
    av.property_manager_name,
    av.property_manager_email,
    av.listing_name,
    av.listing_address,
    av.listing_town,
    av.listing_country,
    av.listing_postcode,
    av.level_of_protection_amount,
    av.level_of_protection_currency,
    av.pets_allowed,
    av.status_updated_at_utc,
    av.status_updated_date_utc,
    av.updated_at_utc,
    av.athena_creation_at_utc,
    av.athena_creation_date_utc,
    av.created_at_utc,
    av.created_date_utc
from int_athena__verifications av
union all
select
    ev.id_verification,
    ev.id_booking,
    ev.id_user_partner,
    ev.id_accommodation,
    ev.version,
    ev.verification_source,
    ev.verification_status,
    ev.nightly_fee_local,
    ev.nightly_fee_local * ev.number_nights as total_fee_local,
    ev.number_nights,
    ev.email_flag,
    ev.phone_flag,
    ev.watch_list,
    ev.channel,
    ev.checkin_at_utc,
    ev.checkin_date_utc,
    ev.checkout_at_utc,
    ev.checkout_date_utc,
    ev.is_cancelled,
    ev.cancelled_at_utc,
    ev.cancelled_date_utc,
    ev.user_email,
    ev.guest_email,
    ev.guest_last_name,
    ev.guest_first_name,
    ev.guest_telephone,
    ev.company_name,
    null as property_manager_name,
    null as property_manager_email,
    ev.listing_name,
    ev.listing_address,
    ev.listing_town,
    ev.listing_country,
    ev.listing_postcode,
    null as level_of_protection_amount,
    null as level_of_protection_currency,
    ev.pets_allowed,
    ev.status_updated_at_utc,
    ev.status_updated_date_utc,
    ev.updated_at_utc,
    ev.athena_creation_at_utc,
    ev.athena_creation_date_utc,
    ev.created_at_utc,
    ev.created_date_utc
from int_edeposit__verifications ev
