/**
 * Row shapes mirroring server/src/db/migrations/001_init.sql.
 * SQLite returns snake_case columns and `null` for nullable fields.
 */

export interface UserRow {
  id: number;
  email: string;
  password_hash: string;
  created_at: string;
}

export interface FeedRow {
  id: number;
  url: string;
  title: string | null;
  description: string | null;
  site_url: string | null;
  etag: string | null;
  last_modified: string | null;
  last_fetched_at: string | null;
  last_success_at: string | null;
  failure_count: number;
  last_error: string | null;
  next_poll_at: string;
  created_at: string;
}

export interface ItemRow {
  id: number;
  feed_id: number;
  dedup_key: string;
  guid: string | null;
  url: string;
  title: string;
  content_html: string | null;
  content_text: string | null;
  author: string | null;
  published_at: string;
  fetched_at: string;
}

export interface SubscriptionRow {
  user_id: number;
  feed_id: number;
  created_at: string;
}

export interface ReadStateRow {
  user_id: number;
  item_id: number;
  read_at: string | null;
}
