//! Compile-time integration tests for the `utoipa` feature (E14-S51).
//!
//! Verifies that all key BO and COM types implement `utoipa::ToSchema`, making
//! them usable in OpenAPI documentation generated by utoipa.
//!
//! Run with:
//! ```text
//! cargo test --test utoipa_compile --features utoipa,versioned
//! ```

#[cfg(all(feature = "utoipa", feature = "versioned"))]
mod utoipa_tests {
    /// Helper that requires `T: utoipa::ToSchema` — fails to compile if missing.
    fn assert_to_schema<T: utoipa::ToSchema>() {}

    #[test]
    fn bo_types_implement_to_schema() {
        use rubo4e::v202501::*;

        // Business Objects
        assert_to_schema::<Vertrag>();
        assert_to_schema::<Marktlokation>();
        assert_to_schema::<Messlokation>();
        assert_to_schema::<Rechnung>();
        assert_to_schema::<Geschaeftspartner>();
        assert_to_schema::<Netzlokation>();
        assert_to_schema::<Energiemenge>();
        assert_to_schema::<Lastgang>();
    }

    #[test]
    fn com_types_implement_to_schema() {
        use rubo4e::v202501::*;

        // Components
        assert_to_schema::<Adresse>();
        assert_to_schema::<Menge>();
        assert_to_schema::<Preis>();
        assert_to_schema::<Zeitraum>();
        assert_to_schema::<Betrag>();
    }

    #[test]
    fn enum_types_implement_to_schema() {
        use rubo4e::v202501::*;

        assert_to_schema::<Sparte>();
        assert_to_schema::<BoTyp>();
        assert_to_schema::<Mengeneinheit>();
        assert_to_schema::<Waehrungscode>();
    }

    #[test]
    fn identifier_types_implement_to_schema() {
        use rubo4e::identifiers::*;

        assert_to_schema::<MaloId>();
        assert_to_schema::<MeloId>();
        assert_to_schema::<EicCode>();
        assert_to_schema::<MarktpartnerId>();
    }
}
