with
    stg_xero__bank_transactions as (
        select * from {{ ref("stg_xero__bank_transactions") }}
    )
select
    bt.id_bank_transaction,
    bt.id_prepayment,
    bt.id_overpayment,
    bt.reference,
    bt.transaction_type,
    bt.transaction_status,
    bt.transaction_at_utc,
    bt.date_string,
    bt.total_amount_local_curr,
    (bt.total_amount_local_curr * bt.exchange_rate_to_gbp)::numeric(
        18, 4
    ) as total_amount_in_gbp,
    bt.total_amount_wo_tax_local_curr,
    (bt.total_amount_wo_tax_local_curr * bt.exchange_rate_to_gbp)::numeric(
        18, 4
    ) as total_amount_wo_tax_in_gbp,
    bt.total_tax_local_curr,
    (bt.total_tax_local_curr * bt.exchange_rate_to_gbp)::numeric(
        18, 4
    ) as total_tax_in_gbp,
    bt.transaction_currency_iso_4217,
    bt.exchange_rate_to_gbp,
    bt.line_amount_tax_inclusiveness,
    bt.full_contact_details,
    bt.line_items,
    bt.bank_account,
    bt.is_reconciled,
    bt.has_attachments,
    bt.url,
    bt.external_link_provider_name,
    bt.updated_at_utc,
    bt.updated_date_utc,
    bt.dwh_extracted_at_utc
from stg_xero__bank_transactions bt
