/*
    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>
*/

use jellyobject::{Object, Tag, enums, fields};

fields! {
    QUERY_PARENT: u64 = b"prnt";
    QUERY_SEARCH: &str = b"sear";
    QUERY_KIND: Tag = b"kind"; // multi
    QUERY_SORT: Tag = b"sort"; // one of RTYP_*, NU_RATING, NO_DURATION, NO_NAME
    QUERY_SORT_ASCENDING: () = b"sasc";

    VIEW_TITLE: &str = b"titl";
    VIEW_MESSAGE: Object = b"mesg";
    VIEW_NODE_PAGE: Object = b"npag";
    VIEW_NODE_LIST: Object = b"nlis"; // multi
    VIEW_PLAYER: Object = b"play";
    VIEW_STATGROUP: Object = b"stag";
    VIEW_STATTEXT: Object = b"stat";
    VIEW_ACCOUNT_LOGIN: () = b"acli";
    VIEW_ACCOUNT_LOGOUT: () = b"aclo";
    VIEW_ACCOUNT_SET_PASSWORD: &str = b"acsp";
    VIEW_ADMIN_DASHBOARD: () = b"adda";
    VIEW_ADMIN_IMPORT: Object = b"adim";
    VIEW_ADMIN_INFO: Object = b"adin";
    VIEW_ADMIN_LOG: Object = b"adlo";
    VIEW_USER_SETTINGS: Object = b"uset";

    ADMIN_IMPORT_BUSY: () = b"busy";
    ADMIN_IMPORT_ERROR: &str = b"erro"; // multi
    ADMIN_INFO_TITLE: &str = b"aiti";
    ADMIN_INFO_TEXT: &str = b"aite";
    ADMIN_LOG_MESSAGE: &str = b"aite";

    NKU_NODE: Object = b"node";
    NKU_UDATA: Object = b"udat";
    NKU_ROLE: &str = b"role";

    NODELIST_TITLE: &str = b"titl";
    NODELIST_DISPLAYSTYLE: Tag = b"dsty";
    NODELIST_ITEM: Object = b"item"; // multi

    MESSAGE_KIND: &str = b"kind";
    MESSAGE_TEXT: &str = b"text";

    STATGROUP_TITLE: &str = b"titl";
    STATGROUP_BIN: Object = b"bin1";

    STAT_NAME: &str = b"name";
    STAT_COUNT: u64 = b"cont";
    STAT_TOTAL_SIZE: u64 = b"tlsz";
    STAT_TOTAL_DURATION: f64 = b"tldu";
    STAT_MAX_SIZE: u64 = b"mxsz";
    STAT_MAX_DURATION: f64 = b"mxdu";
}

enums! {
    NLSTYLE_GRID = b"grid";
    NLSTYLE_INLINE = b"inli";
    NLSTYLE_LIST = b"list";
    NLSTYLE_HIGHLIGHT = b"hglt";
}

// use crate::user::{NodeUserData, User};
// use std::{collections::BTreeMap, sync::Arc, time::Duration};
// pub struct ApiNodeResponse {
//     pub parents: NodesWithUdata,
//     pub children: NodesWithUdata,
//     pub node: Arc<Node>,
//     pub userdata: NodeUserData,
// }

// pub struct ApiSearchResponse {
//     pub count: usize,
//     pub results: NodesWithUdata,
//     pub duration: Duration,
// }

// pub struct ApiItemsResponse {
//     pub count: usize,
//     pub pages: usize,
//     pub items: NodesWithUdata,
// }

// pub struct ApiHomeResponse {
//     pub toplevel: NodesWithUdata,
//     pub categories: Vec<(String, NodesWithUdata)>,
// }

// pub struct ApiStatsResponse {
//     pub kinds: BTreeMap<NodeKind, StatsBin>,
//     pub total: StatsBin,
// }

// pub struct ApiAdminUsersResponse {
//     pub users: Vec<User>,
// }

// #[derive(Default, Serialize, Deserialize)]
// pub struct StatsBin {
//     pub runtime: f64,
//     pub size: u64,
//     pub count: usize,
//     pub max_runtime: f64,
//     pub max_runtime_node: String,
//     pub max_size: u64,
//     pub max_size_node: String,
// }
