// SPDX-FileCopyrightText: 2025 Slatian
//
// SPDX-License-Identifier: LGPL-3.0-only

//! Criterium is a mini-framework to make implementing dynamic conditions and database queries easier.
//!
//! It does so by supplying the needed datastructures that can be compiled to SQL and a list of values or directly matched against a given value.
//!
//! Multiple Criteria can also be combined using Boolean logic (see [CriteriumChain]).
//!
//! Dynamic also means configurable, Criterium [integrates itself with Serde][documentation_serde].
//!
//! You can find the souce code and more documentation on [codeberg.org/unobtanium/criterium](https://codeberg.org/unobtanium/criterium).

#![doc = include_str!("../Concepts.md")]

//! # Traits to implement on your criteria
//!
//! By default, the [CriteriumChain] accepts any data type as the criterium it contains.
//!
//! However, Criterium is only really useful the criteria implement one or more of the following traits:
//!
//! * [DirectMatch] - If you want to compare against a rust data structure directly. (With known or unknown result)
//! * Also see the `rusqlite` module for traits that are needed to interoperate with rusqlite.
//!
//! # Feature flags
//!
//! * `rusqlite` - Enable compiling to SQLite SQL and rusqlite values.
//! * `chrono` - Allows using [DateTime] in place of numbers, they will be interpreted as a unix utc timestamp.
//! * `serde` - Enables serializing and deserialzing. (See the [documentation_serde] module)
//!
//! [DateTime]: https://docs.rs/chrono/latest/chrono/struct.DateTime.html

// Linting
#![warn(missing_docs)]
#![allow(clippy::needless_return)] // Explicit retuns improve readability
#![allow(clippy::to_string_trait_impl)] // Don't want to to re-implement those right now.
#![allow(clippy::redundant_field_names)] // Being explicit about this isn't bad, especially if multiple fields are involved.
#![allow(clippy::tabs_in_doc_comments)] // Tabs are for indentations so I'll use them for indentations.

mod logic_path;

pub mod boolean;
pub mod chain;
pub mod number;
pub mod search;
pub mod string;
// Might hide behind a feature flag later.
pub mod sql;

pub mod documentation_serde;
#[cfg(feature = "rusqlite")]
pub mod rusqlite;

pub use boolean::BooleanCriterium;
pub use chain::builder::CriteriumChainBuilder;
pub use chain::ChainInto;
pub use chain::CriteriumChain;
pub use chain::CriteriumChainList;
pub use logic_path::LogicPath;
pub use number::NumberCriterium;
pub use string::StringCriterium;

mod boolean_logic;
pub use boolean_logic::BooleanJoiner;

pub mod direct_match;
pub use direct_match::DirectMatch;

pub mod tag;
pub use tag::TagCriterium;
