with int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }})

select
    id_credit_note as id_credit_note,
    id_contact as id_contact,
    reference as reference,
    credit_note_number as credit_note_number,
    credit_note_issued_at_utc as credit_note_issued_at_utc,
    credit_note_issued_date_utc as credit_note_issued_date_utc,
    credit_note_type as credit_note_type,
    credit_note_currency_iso_4217 as credit_note_currency_iso_4217,
    exchange_rate_to_gbp as exchange_rate_to_gbp,
    total_amount_local_curr as total_amount_local_curr,
    total_amount_in_gbp as total_amount_in_gbp,
    subtotal_local_curr as subtotal_local_curr,
    subtotal_in_gbp as subtotal_in_gbp,
    total_tax_local_curr as total_tax_local_curr,
    total_tax_in_gbp as total_tax_in_gbp,
    remaining_credit_local_curr as remaining_credit_local_curr,
    remaining_credit_in_gbp as remaining_credit_in_gbp,
    applied_amount as applied_amount,
    credit_note_status as credit_note_status,
    full_contact_details as full_contact_details,
    credit_note_due_date as credit_note_due_date,
    line_items as line_items,
    date_string as date_string,
    due_date_string as due_date_string,
    allocations as allocations,
    has_been_sent_to_contact as has_been_sent_to_contact,
    has_attachments as has_attachments,
    updated_at_utc as updated_at_utc,
    id_branding_theme as id_branding_theme,
    was_fully_paid_on_date_utc as was_fully_paid_on_date_utc,
    line_amount_tax_inclusiveness as line_amount_tax_inclusiveness,
    updated_date_utc as updated_date_utc,
    dwh_extracted_at_utc as dwh_extracted_at_utc
from int_xero__credit_notes
