/**
 * Provenance vocabulary — who authored a message vs who triggered its send.
 * Fixed set so attribution is queryable; extend here when a new source appears.
 */
export const SEND_ORIGINS = [
  'user',
  'claude-prospector',
  'claude-messenger',
  'autoresponder',
  'scheduled-worker',
  'unknown',
] as const;
export type SendOrigin = (typeof SEND_ORIGINS)[number];

export interface SendQueueRow {
  id: string;
  device_id: string;
  to_handle: string;
  body: string;
  status: 'queued' | 'sent' | 'failed';
  send_queue_id?: string | null;
  sent_at?: string | null;
  failure_reason?: string | null;
  /** Who composed the message text. */
  authored_by?: SendOrigin | null;
  /** What triggered the send (pressed "send"). */
  dispatched_by?: SendOrigin | null;
  created_at: string;
  updated_at: string;
}

/**
 * Global outbound send-rate cap: at most `maxSends` releases per `windowSeconds`.
 * `autoQueue` true (default) holds over-cap sends in the queue to drip out;
 * false disables the cap (queued sends release immediately).
 */
export interface SendRateConfig {
  maxSends: number;
  windowSeconds: number;
  autoQueue: boolean;
  updatedAt: string;
}
