//! # Kubernetes Manager
//!
//! A comprehensive Rust library for managing Kubernetes resources.
//!
//! This library provides a high-level, ergonomic API for common Kubernetes operations
//! including deployments, services, secrets, and namespace management.
//!
//! ## Features
//!
//! - **Deployment Management**: Create, update, rollback, and scale deployments
//! - **Service Management**: Manage Kubernetes Services with different types (ClusterIP, NodePort, LoadBalancer)
//! - **Secret Management**: Handle Docker registry secrets and generic secrets
//! - **Namespace Operations**: Create and manage namespaces
//! - **Health Monitoring**: Wait for deployments to be ready with detailed error reporting
//! - **Builder Pattern**: Ergonomic API for constructing resource specifications
//!
//! ## Quick Start
//!
//! ```no_run
//! use lmrc_kubernetes::{Client, ClientConfig};
//! use lmrc_kubernetes::deployment::{DeploymentSpec, ContainerSpec};
//! use lmrc_kubernetes::config::DeploymentOptions;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     // Create a client
//!     let config = ClientConfig::infer().await?;
//!     let client = Client::new(config, "default").await?;
//!
//!     // Ensure namespace exists
//!     client.namespaces().ensure("my-app").await?;
//!
//!     // Create a deployment
//!     let container = ContainerSpec::new("app", "nginx:1.21")
//!         .with_port(80)
//!         .with_env("ENV", "production");
//!
//!     let deployment = DeploymentSpec::new("web-app")
//!         .with_replicas(3)
//!         .with_container(container);
//!
//!     let options = DeploymentOptions::new()
//!         .timeout_secs(300)
//!         .wait(true);
//!
//!     // Switch to the target namespace
//!     let app_client = client.with_namespace("my-app");
//!     app_client.deployments().apply(&deployment, &options).await?;
//!
//!     // Get deployment status
//!     let status = app_client.deployments().status("web-app").await?;
//!     println!("Ready: {}/{}", status.ready_replicas, status.replicas);
//!
//!     Ok(())
//! }
//! ```
//!
//! ## Configuration
//!
//! The library supports multiple ways to configure Kubernetes access:
//!
//! ```no_run
//! use lmrc_kubernetes::ClientConfig;
//!
//! # async fn examples() -> Result<(), Box<dyn std::error::Error>> {
//! // Infer from environment (tries in-cluster, then KUBECONFIG, then ~/.kube/config)
//! let config = ClientConfig::infer().await?;
//!
//! // Use a specific kubeconfig file
//! let config = ClientConfig::from_kubeconfig("/path/to/kubeconfig").await?;
//!
//! // Use in-cluster configuration (when running inside a pod)
//! let config = ClientConfig::in_cluster()?;
//!
//! // Customize field manager name
//! let config = ClientConfig::infer().await?
//!     .with_field_manager("my-app");
//! # Ok(())
//! # }
//! ```

#![deny(missing_docs)]
#![warn(clippy::all)]

mod client;
pub mod config;
pub mod configmap;
pub mod cronjob;
pub mod deployment;
pub mod error;
pub mod gateway;
pub mod hpa;
pub mod ingress;
pub mod job;
pub mod namespace;
pub mod networkpolicy;
pub mod pvc;
pub mod secret;
pub mod service;

// Re-export main types for convenience
pub use client::Client;
pub use config::{ClientConfig, DeploymentOptions, RollbackOptions};
pub use error::{Error, Result};

// Re-export commonly used deployment types
pub use deployment::{
    ContainerSpec, DeploymentManager, DeploymentSpec, DeploymentStatus, DeploymentStrategy,
    ExecProbe, HttpGetProbe, KeyToPath, ProbeSpec, ResourceRequirements, TcpSocketProbe, Volume,
    VolumeMount, VolumeSource,
};

// Re-export service types
pub use service::{ServiceManager, ServiceSpec, ServiceType};

// Re-export secret manager
pub use secret::SecretManager;

// Re-export namespace manager
pub use namespace::NamespaceManager;

// Re-export ConfigMap types
pub use configmap::{ConfigMapManager, ConfigMapSpec};

// Re-export Ingress types
pub use ingress::{IngressManager, IngressRule, IngressSpec, IngressTLS, PathType};

// Re-export Gateway API types
pub use gateway::{GatewayManager, GatewaySpec, HTTPRoute, HTTPRouteRule, Protocol};

// Re-export NetworkPolicy types
pub use networkpolicy::{
    NetworkPolicyManager, NetworkPolicySpec, PolicyRule, PolicyType, PortProtocol,
};

// Re-export Job types
pub use job::{JobManager, JobSpec, RestartPolicy};

// Re-export CronJob types
pub use cronjob::{ConcurrencyPolicy, CronJobManager, CronJobSpec};

// Re-export PVC types
pub use pvc::{AccessMode, PersistentVolumeClaimSpec, PvcManager, StorageClass};

// Re-export HPA types
pub use hpa::{HpaManager, HpaSpec, MetricTarget, MetricType, ScaleTargetRef};
