export type ProfileKind = "xtream" | "m3u" | "stalker";
export type ProfileTarget = "all" | "live" | "vod";

export interface XtreamProfile {
  id: string;
  name: string;
  kind?: ProfileKind; // defaults to 'xtream' for backwards compat
  /** Which section this profile is used for: "all" (default), "live", or "vod" */
  target?: ProfileTarget;
  // Xtream Codes
  serverUrl: string;
  username: string;
  password: string;
  // M3U
  m3uUrl?: string;
  // M3U file content (raw text from uploaded .m3u/.m3u8 file)
  m3uContent?: string;
  // Stalker / MAC portal
  portalUrl?: string;
  macAddress?: string;
  managed?: boolean;
  /** BUG-6 FIX (2026-05): hard owner-scoping for the IndexedDB profile
   *  store. New profiles are stamped with the currently-logged-in user's
   *  id at creation time. The Account "Owned" list filters on this so
   *  a brand-new account NEVER inherits the previous user's playlists
   *  AND the auto-injected managed (shared-creds) profile is excluded.
   *
   *  Special values:
   *    "shared"  → mirrored from /api/shared-profiles (admin-pushed)
   *    "managed" → resolved Xtream creds from /api/subscription/status
   *    "guest"   → not-logged-in session
   *    <userId>  → owned by this specific authenticated user
   */
  ownerUserId?: string;
}

export interface Channel {
  id: string;
  name: string;
  category: string;
  categoryId: string;
  streamUrl: string;
  logoUrl?: string;
  epgChannelId?: string;
}

export interface Movie {
  id: string;
  name: string;
  category: string;
  categoryId: string;
  streamUrl: string;
  posterUrl?: string;
  rating?: string;
  year?: string;
  containerExtension?: string;
}

export interface Series {
  id: string;
  name: string;
  category: string;
  categoryId: string;
  posterUrl?: string;
  rating?: string;
  plot?: string;
}

export interface XtreamCategory {
  category_id: string;
  category_name: string;
}
