CREATE TABLE IF NOT EXISTS netup_push_log (
  id          BIGSERIAL PRIMARY KEY,
  hotel_id    UUID NOT NULL REFERENCES hotels(id) ON DELETE CASCADE,
  ts          TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  action      TEXT NOT NULL,          -- 'check-in' | 'check-out' | 'message'
  room_number TEXT NOT NULL DEFAULT '',
  netup_room  TEXT NOT NULL DEFAULT '',
  url         TEXT NOT NULL DEFAULT '',
  request_body  JSONB,
  status      TEXT NOT NULL,          -- 'ok' | 'error' | 'skipped'
  http_status INT,
  response_body TEXT,
  error       TEXT
);

CREATE INDEX IF NOT EXISTS idx_netup_push_log_hotel_ts ON netup_push_log(hotel_id, ts DESC);
