// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Redfish protocol client
//!
//! This crate provides a thin, ergonomic layer on top of generated Redfish
//! schema types and the `nv-redfish-core` primitives. It focuses on:
//! - High-level entry points (for example, [`ServiceRoot`])
//! - Modular, feature-gated services (enable only what you need)
//! - OEM extension support (also under feature flags)
//! - Patch helpers for vendor quirks that deviate from the Redfish CSDL
//!
//! Relationship to other crates
//! - Depends on `nv-redfish-core` for transport-agnostic traits (`Bmc`) and
//!   foundational types (`ODataId`, navigation properties, actions).
//! - Uses code generated by the CSDL compiler (included via the internal
//!   `schema` module) and re-exports ergonomic wrappers where applicable.
//! - The set of compiled schemas is controlled by `features.toml` to include
//!   only what is required by enabled features — keeping the build as
//!   lightweight as possible.
//!
//! Features
//! - `accounts`: enables the `AccountService` wrappers (implemented).
//! - OEM-specific feature flags (planned) enable vendor extensions when needed.
//!
//! Status
//! - Currently, the `accounts` service is implemented. More services and OEM
//!   extensions will be added to support a variety of vendors in a compatible
//!   manner.
//!

#![recursion_limit = "256"]
#![deny(
    clippy::all,
    clippy::pedantic,
    clippy::nursery,
    clippy::suspicious,
    clippy::complexity,
    clippy::perf
)]
#![deny(
    clippy::absolute_paths,
    clippy::todo,
    clippy::unimplemented,
    clippy::tests_outside_test_module,
    clippy::panic,
    clippy::unwrap_used,
    clippy::unwrap_in_result,
    clippy::unused_trait_names,
    clippy::print_stdout,
    clippy::print_stderr
)]
#![deny(missing_docs)]
#![allow(clippy::doc_markdown)]

/// Errors defined by the crate.
pub mod error;

/// Service Root implementation.
pub mod service_root;

/// Redfish resource common functions.
pub mod resource;

/// Hardware identifier (Manufacturer + Model + Part Number + Serial
/// Number).
pub mod hardware_id;

/// Accounts Service.
#[cfg(feature = "accounts")]
pub mod account;
/// Chassis.
#[cfg(feature = "chassis")]
pub mod chassis;
/// Computer System.
#[cfg(feature = "computer-systems")]
pub mod computer_system;
/// Manager.
#[cfg(feature = "managers")]
pub mod manager;
/// Update Service.
#[cfg(feature = "update-service")]
pub mod update_service;

#[cfg(feature = "assembly")]
pub mod assembly;
/// Ethernet interfaces.
#[cfg(feature = "ethernet-interfaces")]
pub mod ethernet_interface;
/// Log Service.
#[cfg(feature = "log-services")]
pub mod log_service;
/// `PCIe` devices.
#[cfg(feature = "pcie-devices")]
pub mod pcie_device;
/// Metrics and sensor abstraction.
#[cfg(feature = "sensors")]
pub mod sensor;

/// Individual OEM extensions support.
#[cfg(feature = "oem")]
pub mod oem;

/// Compiled Redfish schema.
pub(crate) mod schema;

#[cfg(feature = "accounts")]
pub(crate) mod patch_support;

/// Redfish protocol features.
pub(crate) mod protocol_features;

/// Bmc wrapper used in nv-redfish.
pub(crate) mod bmc;

#[doc(inline)]
pub use error::Error;
#[doc(inline)]
pub use nv_redfish_core::Bmc;
#[doc(inline)]
pub use protocol_features::ProtocolFeatures;
#[doc(inline)]
pub use resource::Resource;
#[doc(inline)]
pub use service_root::ServiceRoot;

#[doc(inline)]
#[cfg(feature = "resource-status")]
pub use resource::ResourceProvidesStatus;

pub(crate) use crate::schema::redfish::resource::Resource as ResourceSchema;
#[cfg(feature = "resource-status")]
pub(crate) use crate::schema::redfish::resource::Status as ResourceStatusSchema;
pub(crate) use bmc::NvBmc;
