-- name: InsertEvent :one
INSERT INTO acp_events (
  session_id, direction, rpc_kind, method, payload, payload_size, truncated
) VALUES ($1, $2, $3, $4, $5, $6, $7)
RETURNING id, session_id, direction, rpc_kind, method, payload,
          payload_size, truncated, created_at;

-- name: ListEventsSince :many
SELECT id, session_id, direction, rpc_kind, method, payload,
       payload_size, truncated, created_at
FROM acp_events
WHERE session_id = $1 AND id > $2
ORDER BY id ASC
LIMIT $3;

-- name: PurgeEventsBefore :execrows
DELETE FROM acp_events WHERE created_at < $1;
