/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

export interface NodePublic {
    kind: NodeKind,
    title?: string,
    tagline?: string,
    description?: string,
    id?: string,
    path: string[],
    children: string[],
    release_date?: string,
    index?: number,
    media?: MediaInfo,
    ratings: { [key in Rating]: number },
    // might be incomplete
}

export type NodeKind = "movie"
    | "video"
    | "collection"
    | "channel"
    | "show"
    | "series"
    | "season"
    | "episode"

export type Rating = "imdb"
    | "tmdb"
    | "rotten_tomatoes"
    | "metacritic"
    | "youtube_views"
    | "youtube_likes"
    | "youtube_followers"

export interface MediaInfo {
    duration: number,
    tracks: SourceTrack[],
    chapters: Chapter[],
}

export interface Chapter {
    time_start?: number,
    time_end?: number,
    labels: { [key: string]: string }
}

export interface SourceTrack {
    kind: SourceTrackKind,
    name: string,
    codec: string,
    language: string,
}
export type SourceTrackKind = {
    video: {
        width: number,
        height: number,
        fps: number,
    }
}
    | {
        audio: {
            channels: number,
            sample_rate: number,
            bit_depth: number,
        }
    } | "subtitle";

export interface NodeUserData {
    watched: WatchedState
}
export type WatchedState = "none" | "watched" | "pending" | { progress: number }

