-- Календарь пассивных окон по дням недели: в это время все агенты в режиме passive (сами не пишут, на сообщения отвечают как обычно). -- Первое окно: встреча менеджеров по вторникам (обсуждают статус работ). create table agent_passive_window ( id uuid primary key default gen_random_uuid(), weekday smallint not null check (weekday between 1 and 7), -- ISO: 1 - понедельник ... 7 - воскресенье from_minute smallint not null default 0 check (from_minute between 0 and 1439), -- минут от полуночи, включительно to_minute smallint not null default 1440 check (to_minute between 1 and 1440), -- минут от полуночи, не включительно (1440 - до конца дня) timezone text not null default 'America/New_York', is_active boolean not null default true, note text, created_at timestamptz not null default now(), check (from_minute < to_minute) ); alter table agent_passive_window enable row level security; insert into agent_passive_window (weekday, from_minute, to_minute, note) values (2, 0, 1440, 'встреча менеджеров по вторникам: обсуждают статус работ');