/*
    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) 2025 metamuffin <metamuffin.org>
*/
#![feature(array_try_map)]
pub mod routes;
use jellyobject::{Object, Registry, Tag, enums, fields};
pub use jellystream_types as stream;
use std::sync::LazyLock;

pub use jellyobject;

pub static TAGREG: LazyLock<Registry> = LazyLock::new(|| {
    let mut reg = Registry::default();
    register_fields(&mut reg);
    register_enums(&mut reg);
    reg
});

fields! {
    // Tag counter: 36

    NO_KIND: Tag = 1 "kind";
    NO_TITLE: &str = 2 "title";
    NO_PARENT: u64 = 3 "parent"; // multi
    NO_TAGLINE: &str = 4 "tagline";
    NO_DESCRIPTION: &str = 5 "description";
    NO_RELEASEDATE: u64 = 6 "releasedate";
    NO_INDEX: u64 = 7 "index";
    NO_SEASON_INDEX: u64 = 8 "season_index";
    NO_TRACK: Object = 9 "track"; // multi
    NO_CHAPTER: Object = 32 "chapter"; // multi
    NO_TAG: &str = 10 "tag"; // multi
    NO_RATINGS: Object = 11 "ratings";
    NO_PICTURES: Object = 12 "pictures";
    NO_IDENTIFIERS: Object = 13 "identifiers";
    NO_VISIBILITY: Tag = 14 "visibility";
    NO_STORAGE_SIZE: u64 = 15 "storage_size";
    NO_CREDIT: Object = 33 "credit"; // multi

    CR_NODE: u64 = 34 "node";
    CR_KIND: Tag = 35 "kind";
    CR_ROLE: &str = 36 "role"; // multi

    TR_KIND: Tag = 16 "kind";
    TR_SOURCE: &str = 17 "source";
    TR_NAME: &str = 18 "name";
    TR_CODEC: &str = 19 "codec";
    TR_LANGUAGE: Tag = 20 "language";
    TR_RATE: f64 = 23 "rate";
    TR_BIT_DEPTH: f64 = 25 "bit_depth";
    TR_CHANNELS: f64 = 28 "channels";
    TR_PIXEL_WIDTH: u32 = 26 "pixel_width";
    TR_PIXEL_HEIGHT: u32 = 27 "pixel_height";

    TRSOURCE_LOCAL_PATH: &str = 21 "local_path";
    TRSOURCE_LOCAL_TRACKNUM: u64 = 22 "local_tracknum";

    CH_START: f64 = 29 "start";
    CH_END: f64 = 30 "end";
    CH_NAME: &str = 31 "name";

    LANG_NATIVE: &str = 0xa001 "native";
    LANG_ENG: &str = 0xa002 "eng";
    LANG_DEU: &str = 0xa003 "deu";
    LANG_JPN: &str = 0xa003 "jpn";

    PICT_COVER: &str = 0xd001 "cover";
    PICT_BACKDROP: &str = 0xd001 "backdrop";

    RTYP_IMDB: f64 = 0xf001 "imdb";
    RTYP_TMDB: f64 = 0xf002 "tmdb";
    RTYP_ROTTEN_TOMATOES: f64 = 0xf003 "rotten_tomatoes";
    RTYP_METACRITIC: f64 = 0xf004 "metacritic";
    RTYP_YOUTUBE_VIEWS: f64 = 0xf005 "youtube_views";
    RTYP_YOUTUBE_LIKES: f64 = 0xf006 "youtube_likes";
    RTYP_YOUTUBE_FOLLOWERS: f64 = 0xf007 "youtube_followers";
    RTYP_TRAKT: f64 = 0xf008 "trakt";

    IDENT_MUSICBRAINZ_RECORDING: &str = 0xc001 "musicbrainz_recording";
    IDENT_MUSICBRAINZ_ARTIST: &str = 0xc002 "musicbrainz_artist";
    IDENT_MUSICBRAINZ_RELEASE: &str = 0xc003 "musicbrainz_release";
    IDENT_MUSICBRAINZ_RELEASE_GROUP: &str = 0xc004 "musicbrainz_release_group";
    IDENT_ACOUST_ID_TRACK: &str = 0xc005 "acoust_id_track";
    IDENT_YOUTUBE_VIDEO: &str = 0xc006 "youtube_video";
    IDENT_YOUTUBE_CHANNEL: &str = 0xc007 "youtube_channel";
    IDENT_YOUTUBE_CHANNEL_HANDLE: &str = 0xc008 "youtube_channel_handle";
    IDENT_BANDCAMP: &str = 0xc009 "bandcamp";
    IDENT_ISRC: &str = 0xc00a "isrc";
    IDENT_BARCODE: &str = 0xc00b "barcode";
    IDENT_TRAKT_MOVIE: &str = 0xc00c "trakt_movie";
    IDENT_TRAKT_SHOW: &str = 0xc00d "trakt_show";
    IDENT_TRAKT_SEASON: &str = 0xc00e "trakt_season";
    IDENT_TRAKT_EPISODE: &str = 0xc00f "trakt_episode";
    IDENT_IMDB: &str = 0xc010 "imdb";
    IDENT_TMDB_SERIES: &str = 0xc011 "tmdb_series";
    IDENT_TMDB_MOVIE: &str = 0xc012 "tmdb_movie";
    IDENT_TVDB: &str = 0xc013 "tvdb";
    IDENT_OMDB: &str = 0xc014 "omdb";
    IDENT_VGMDB_ARTIST: &str = 0xc015 "vgmdb_artist";

}

enums! {
    VISI_HIDDEN = 0xe001 "hidden";
    VISI_REDUCED = 0xe002 "reduced";
    VISI_VISIBLE = 0xe003 "visible";

    TRKIND_VIDEO = 0x1001 "video";
    TRKIND_AUDIO = 0x1001 "audio";
    TRKIND_TEXT = 0x1001 "text";

    KIND_MOVIE = 0xb001 "movie";
    KIND_VIDEO = 0xb002 "video";
    KIND_MUSIC = 0xb003 "music";
    KIND_SHORTFORMVIDEO = 0xb004 "shortformvideo";
    KIND_COLLECTION = 0xb005 "collection";
    KIND_CHANNEL = 0xb006 "channel";
    KIND_SHOW = 0xb007 "show";
    KIND_SERIES = 0xb008 "series";
    KIND_SEASON = 0xb009 "season";
    KIND_EPISODE = 0xb00a "episode";

    CRCAT_CAST = 0x2001 "cast";
    CRCAT_WRITING = 0x2002 "writing";
    CRCAT_DIRECTING = 0x2003 "directing";
    CRCAT_ART = 0x2004 "art";
    CRCAT_SOUND = 0x2005 "sound";
    CRCAT_CAMERA = 0x2006 "camera";
    CRCAT_LIGHTING = 0x2007 "lighting";
    CRCAT_CREW = 0x2008 "crew";
    CRCAT_EDITING = 0x2009 "editing";
    CRCAT_PRODUCTION = 0x200a "production";
    CRCAT_VFX = 0x200b "vfx";
    CRCAT_COSTUME_MAKEUP = 0x200c "costume_makeup";
    CRCAT_CREATED_BY = 0x200d "created_by";
    CRCAT_PERFORMANCE = 0x200e "performance";
    CRCAT_INSTRUMENT = 0x200f "instrument";
    CRCAT_VOCAL = 0x2010 "vocal";
    CRCAT_ARRANGER = 0x2011 "arranger";
    CRCAT_PRODUCER = 0x2012 "producer";
    CRCAT_ENGINEER = 0x2013 "engineer";
}
