with stg_xero__contacts as (select * from {{ ref("stg_xero__contacts") }})
select
    id_contact,
    account_number,
    case when account_number ~ '^[0-9]{10,11}$' then account_number else null end::text
    as id_deal,
    contact_name,
    is_customer,
    is_supplier,
    tax_number,
    contact_first_name,
    contact_last_name,
    phones,
    website,
    balances,
    discount,
    addresses,
    attachments,
    email_addresses,
    payment_terms,
    batch_payments,
    branding_theme,
    contact_groups,
    contact_number,
    contact_status,
    skyper_user_name,
    contact_persons,
    has_attachments,
    updated_at_utc,
    updated_date_utc,
    xero_network_key,
    default_currency_iso_4217,
    validation_errors,
    bank_account_details,
    has_validation_errors,
    tracking_category_name,
    account_payable_tax_type,
    tracking_category_option,
    sales_default_account_code,
    sales_tracking_categories,
    account_receivable_tax_type,
    purchases_default_account_code,
    purchases_tracking_categories,
    dwh_extracted_at_utc
from stg_xero__contacts
