select
    'DRIVER' as entity_type,
    cast(d.id as varchar(128)) as source_entity_id,
    coalesce(nullif(left(trim(d.drivers_card), 14), ''), cast(d.id as varchar(128))) as source_external_key,
    nullif(trim(concat_ws(' ', d.firstname, d.name)), '') as display_name,
    true as active,
    null::timestamptz as valid_from,
    null::timestamptz as valid_to,
    null::timestamptz as source_updated_at,
    d.id as driver_id,
    d.firstname as first_names,
    d.name as last_name,
    d.fleet_id as fleet_id
from data.driver d;
