/*
    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 jellycommon::jellyobject::path::Path;

pub struct Query {
    pub filter: Filter,
    pub sort: Sort,
}

pub enum Sort {
    None,
    Value(ValueSortComponent),
    TextSearch(Path, String),
}
pub struct ValueSortComponent {
    pub order: SortOrder,
    pub path: Path,
    pub multi: MultiBehaviour,
    pub offset: Option<Vec<u8>>,
}
pub enum MultiBehaviour {
    First,
    ForEach,
    Max,
    Min,
    Count,
}
pub enum SortOrder {
    Ascending,
    Descending,
}

#[derive(Debug, Clone)]
pub enum Filter {
    All(Vec<Filter>),
    Any(Vec<Filter>),
    Match(Path, Vec<u8>),
    Has(Path),
}
