BEGIN;

CREATE TABLE IF NOT EXISTS pilot_requests (
  id         uuid        PRIMARY KEY DEFAULT gen_random_uuid(),
  name       text        NOT NULL,
  phone      text,
  email      text,
  company    text,
  message    text,
  source     text,                        -- 'landing', 'analyze_page', etc
  user_agent text,
  created_at timestamptz NOT NULL DEFAULT NOW(),
  notified_at timestamptz                 -- when Telegram sent
);

CREATE INDEX IF NOT EXISTS pilot_requests_created_idx
    ON pilot_requests (created_at DESC);

COMMENT ON TABLE pilot_requests IS '#307 SF-B3 lead generation, опционально notified в Telegram.';

COMMIT;
