//! # `tagid` - Typed Unique Identifiers for Rust Entities
//!
//! `tagid` provides a robust system for defining and managing typed unique identifiers in Rust.
//! It supports multiple ID generation strategies (CUID, UUID, Snowflake) and integrates with
//! `serde`, `sqlx`, and other frameworks for seamless use in databases and serialization.
//!
//! ## Features
//!
//! - **Typed Identifiers**: Define entity-specific IDs with compile-time safety.
//! - **Multiple ID Generators**:
//!   - **CUID** (`cuid` feature) - Compact, collision-resistant IDs.
//!   - **ULID** (`ulid` feature) - Universally unique identifiers.
//!   - **UUID** (`uuid` feature) - Universally unique identifiers.
//!   - **Snowflake** (`snowflake` feature) - Time-based, distributed IDs.
//! - **Entity Labeling**: Labels provide contextual meaning to identifiers.
//! - **Serialization & Database Support**:
//!   - [`serde`] integration for JSON and binary serialization.
//!   - [`sqlx`] integration for database storage (`sqlx` feature).
//! - **Custom Labeling**: Define custom label formats for entities.
//!
//! ## Installation
//!
//! Add `tagid` to your `Cargo.toml`, enabling the desired features:
//!
//! ```toml
//! [dependencies]
//! tagid = { version = "1.0", features = ["uuid", "sqlx"] }
//! ```
//!
//! ## Usage
//!
//! ### Defining an Entity with a Typed ID
//!
//! ```rust,ignore
//! use tagid::{Entity, Id, Label};
//!
//! #[derive(Label)]
//! struct User;
//!
//! impl Entity for User {
//!     type IdGen = tagid::UuidGenerator;
//! }
//!
//! let user_id = User::next_id();
//! println!("User ID: {}", user_id);
//! ```
//!
//! ### Labeling System
//!
//! Labels help associate an identifier with an entity, improving clarity in logs and databases:
//!
//! ```rust,ignore
//! use tagid::{Label, Labeling};
//! use tagid::snowflake::pretty::{IdPrettifier, BASE_23};
//! IdPrettifier::global_initialize(BASE_23.clone());
//!
//! #[derive(Label)]
//! struct Order;
//!
//! let order_labeler = Order::labeler();
//! let order_label = order_labeler.label();
//! assert_eq!(order_label, "Order");
//! ```
//!
//! ## Features Overview
//!
//! | Feature       | Description                                                   |
//! |--------------|---------------------------------------------------------------|
//! | `"derive"`   | Enables `#[derive(Label)]` macro for automatic labeling.      |
//! | `"cuid"`     | Enables the [`CuidGenerator`] for CUID-based IDs.             |
//! | `"ulid"`     | Enables the [`UlidGenerator`] for ULID-based IDs.             |
//! | `"uuid"`     | Enables the [`UuidGenerator`] for UUID-based IDs.             |
//! | `"snowflake"`| Enables the [`SnowflakeGenerator`] for distributed IDs.       |
//! | `"sqlx"`     | Enables database integration via [`sqlx`].                    |
//! | `"envelope"` | Provides an envelope struct for wrapping IDs with metadata.   |
//!
//! ## Contributing
//!
//! Contributions are welcome! Open an issue or submit a pull request on [GitHub](https://github.com/dmrolfs/tagid-rs).
//!
//! ## License
//!
//! This project is licensed under the MIT License.

#[cfg(feature = "derive")]
#[allow(unused_imports)]
#[macro_use]
extern crate tagid_derive;
#[cfg(feature = "derive")]
#[doc(hidden)]
pub use tagid_derive::*;

mod label;
mod labeling;

#[cfg(feature = "envelope")]
pub mod envelope;
pub mod id;

pub use id::{Entity, Id, IdGenerator, LabelMode, Labeled, Provenance, Sourced};
pub use label::{Label, LabelPolicy};
pub use labeling::{CustomLabeling, Labeling, MakeLabeling, NoLabeling};

#[cfg(feature = "cuid")]
pub use id::{CuidGenerator, CuidId};

#[cfg(feature = "ulid")]
pub use id::{Ulid, UlidGenerator, UlidId};

#[cfg(feature = "uuid")]
pub use id::UuidGenerator;

#[cfg(feature = "snowflake")]
pub use id::{MachineNode, SnowflakeGenerator, snowflake};

// The default delimiter used to separate entity labels from their ID values.
pub const DELIMITER: &str = "::";
