import type { Nullable } from "./shared.js"; /** * Channel definition mapping a short name to a streaming URL with optional configuration overrides. */ export interface Channel { channelNumber?: number; channelSelector?: string; name?: string; pacificStationId?: string; profile?: string; provider?: string; scrollSelector?: string; scrollTarget?: string; scrollToBottom?: boolean; stationId?: string; tvgShift?: number; url: string; } /** * Enriched channel entry returned by getChannelListing(). Wraps a Channel definition with source classification and enabled status metadata, providing the * single source of truth for merged channel data across the codebase. */ export interface ChannelListingEntry { availableByProvider: boolean; channel: Channel; enabled: boolean; key: string; source: "override" | "predefined" | "user"; } /** * A delta override for a predefined channel. All fields are optional because only fields that differ from the predefined definition are stored. String and number * fields use Nullable to distinguish "user cleared this field" (null) from "inherit from predefined" (absent). When a field is null, the predefined value is * removed in the resolved channel. When a field is absent, the predefined value is inherited. */ export interface ChannelDelta { channelNumber?: Nullable; channelSelector?: Nullable; name?: Nullable; profile?: Nullable; stationId?: Nullable; tvgShift?: Nullable; url?: Nullable; } /** * What gets stored in channels.json per key. For user-defined channels (no predefined equivalent), this is a full Channel with a required url. For overrides of * predefined channels, this can be a ChannelDelta with only the differing fields. Legacy full-override entries (from before the delta model) are also valid — they * are just deltas that happen to override every field. */ export type StoredChannel = Channel | ChannelDelta; /** * Map of channel keys to stored channel data (full definitions or deltas). This is the raw type for the channels.json file contents. */ export type StoredChannelMap = Record; /** * Map of channel short names to channel definitions. Channel names must be URL-safe strings (lowercase letters, numbers, hyphens) since they appear in stream * request URLs. */ export type ChannelMap = Record; /** * Represents a group of provider variants for the same content. Used by the UI to display provider selection dropdowns for multi-provider channels. */ export interface ProviderGroup { canonicalKey: string; variants: { key: string; label: string; }[]; }