create index if not exists idx_event_detail_yellowfox_slot
    on eventhub.event_detail(detail_type, (attributes ->> 'slot'), event_occurred_at)
    where detail_type in ('DRIVER_ACTIVITY', 'DRIVER_CARD');

create index if not exists idx_event_detail_yellowfox_eventtype_state
    on eventhub.event_detail(
        (attributes ->> 'yellowFoxEventType'),
        (attributes ->> 'yellowFoxState'),
        event_occurred_at
    )
    where attributes ? 'yellowFoxEventType';

create index if not exists idx_event_detail_yellowfox_ignition
    on eventhub.event_detail(detail_type, (attributes ->> 'ignitionState'), event_occurred_at)
    where attributes ? 'ignitionState';
