use serde::{Deserialize, Serialize};

use crate::Protocol;

#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ProductEdition {
    Community,
    Enterprise,
    Cloud,
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MachineAccessMode {
    StaticAgentKey,
    ShortLivedToken,
    OneTimeToken,
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum OperationSecurityLevel {
    Standard,
    Elevated,
    Strict,
}

impl Default for OperationSecurityLevel {
    fn default() -> Self {
        Self::Standard
    }
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct EditionLimits {
    pub max_workspaces: Option<u32>,
    pub max_users_per_workspace: Option<u32>,
    pub max_agents_per_workspace: Option<u32>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct EditionCapabilities {
    pub edition: ProductEdition,
    pub supported_protocols: Vec<Protocol>,
    pub supported_security_levels: Vec<OperationSecurityLevel>,
    pub machine_access_modes: Vec<MachineAccessMode>,
    pub limits: EditionLimits,
}
