select
    'VEHICLE' as entity_type,
    cast(v.id as varchar(128)) as source_entity_id,
    trim(v.vin) as source_external_key,
    coalesce(nullif(trim(v.vrn), ''), trim(v.vin)) as display_name,
    true as active,
    null::timestamptz as valid_from,
    null::timestamptz as valid_to,
    null::timestamptz as source_updated_at,
    v.id as vehicle_id,
    trim(v.vin) as vin,
    trim(v.vrn) as registration_number,
    'UNKNOWN' as registration_nation,
    v.fleet_id as fleet_id,
    v.telematic_provider_id as telematic_provider_id
from data.vehicle v
where nullif(trim(v.vin), '') is not null;
