create type jis_event_severity_level as enum ('INFO', 'WARNING', 'SEVERE');

create table jis_events (
    id uuid not null,
    type varchar(255) not null,
    header_text jsonb not null,
    cause varchar(255) not null,
    cause_detail jsonb not null,
    severity_level jis_event_severity_level not null,
    active_period_start timestamptz not null,
    active_period_end timestamptz,
    effect varchar(255) not null,
    effect_detail jsonb not null,
    description_text jsonb not null,
    url jsonb not null,
    organization_name varchar(255) not null,
    created_timestamp timestamptz not null,
    updated_timestamp timestamptz not null,
    created_at timestamptz not null,
    updated_at timestamptz not null,
    constraint jis_events_pk primary key (id)
);

create table jis_events_ropidgtfs_routes (
    event_id uuid not null,
    route_id varchar(50) not null,
    created_at timestamptz not null,
    updated_at timestamptz not null,
    constraint jis_events_ropidgtfs_routes_pk primary key (event_id, route_id)
);
