pub mod k8s;
mod manager;
pub use manager::*;
use serde::{Deserialize, Serialize};

use std::collections::HashMap;

use crate::data::Id;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] // Assuming serde for Scores
pub struct TenantConfig {
    /// This will be used as the primary unique identifier for management operations and will never
    /// change for the entire lifetime of the tenant
    pub id: Id,

    /// A human-readable name for the tenant (e.g., "client-alpha", "project-phoenix").
    pub name: String,

    /// Desired resource allocations and limits for the tenant.
    pub resource_limits: ResourceLimits,

    /// High-level network isolation policies for the tenant.
    pub network_policy: TenantNetworkPolicy,

    /// Key-value pairs for provider-specific tagging, labeling, or metadata.
    /// Useful for billing, organization, or filtering within the provider's console.
    pub labels_or_tags: HashMap<String, String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct ResourceLimits {
    /// Requested/guaranteed CPU cores (e.g., 2.0).
    pub cpu_request_cores: f32,
    /// Maximum CPU cores the tenant can burst to (e.g., 4.0).
    pub cpu_limit_cores: f32,

    /// Requested/guaranteed memory in Gigabytes (e.g., 8.0).
    pub memory_request_gb: f32,
    /// Maximum memory in Gigabytes tenant can burst to (e.g., 16.0).
    pub memory_limit_gb: f32,

    /// Total persistent storage allocation in Gigabytes across all volumes.
    pub storage_total_gb: f32,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TenantNetworkPolicy {
    /// Policy for ingress traffic originating from other tenants within the same Harmony-managed environment.
    pub default_inter_tenant_ingress: InterTenantIngressPolicy,

    /// Policy for egress traffic destined for the public internet.
    pub default_internet_egress: InternetEgressPolicy,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum InterTenantIngressPolicy {
    /// Deny all traffic from other tenants by default.
    DenyAll,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum InternetEgressPolicy {
    /// Allow all outbound traffic to the internet.
    AllowAll,
    /// Deny all outbound traffic to the internet by default.
    DenyAll,
}
