// SPDX-FileCopyrightText: 2025-2026 RAprogramm <andrey.rozanov.vl@gmail.com>
// SPDX-License-Identifier: MIT

//! Generated code marker utilities.
//!
//! Provides marker comments for generated code to clearly indicate
//! its origin and version. This helps with debugging and bug reports.
//!
//! # Generated Marker
//!
//! All generated items include a doc comment:
//!
//! ```rust,ignore
//! /// Generated by entity-derive v0.2.0
//! #[derive(Debug, Clone)]
//! pub struct CreateUserRequest { ... }
//! ```

use proc_macro2::TokenStream;
use quote::quote;

/// Crate version from Cargo.toml, embedded at compile time.
const VERSION: &str = env!("CARGO_PKG_VERSION");

/// Generates a marker doc comment for generated code.
///
/// Returns a `TokenStream` containing a `#[doc = "..."]` attribute
/// that identifies the code as generated by entity-derive.
///
/// # Example Output
///
/// ```rust,ignore
/// #[doc = " Generated by entity-derive v0.2.0"]
/// ```
#[must_use]
pub fn generated() -> TokenStream {
    let marker = format!(" Generated by entity-derive v{VERSION}");
    quote! { #[doc = #marker] }
}
