// {{ display_name }} MCP server — generated by mcpify. Do not hand-edit.

use serde::{Deserialize, Serialize};

/// One variant per auth scheme mcpify discovered in the OpenAPI spec's
/// `components.securitySchemes` (or the interactive fallback) — REQ-1.2.1-3.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuthMethod {
{%- for method in auth_methods %}
    #[serde(rename = "{{ method.key }}")]
    {{ method.variant_name }},
{%- endfor %}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Transport {
    Stdio,
    Http,
}

fn default_log_level() -> String {
    "info".to_string()
}
fn default_rate_limit() -> u32 {
    100
}
fn default_timeout_ms() -> u64 {
    30_000
}
fn default_cache_size() -> u32 {
    500
}
fn default_retry_attempts() -> u32 {
    3
}
fn default_transport() -> Transport {
    Transport::Stdio
}
fn default_host() -> String {
    "127.0.0.1".to_string()
}
fn default_port() -> u16 {
    3000
}

// mcpify:versions:begin
fn default_api_version() -> String {
    "{{ default_version_label }}".to_string()
}
// mcpify:versions:end

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
    pub url: String,
    pub auth_method: AuthMethod,
    /// v8 multi-version support: an opaque label (not a compile-time enum
    /// like `AuthMethod` — version labels are arbitrary operator-supplied
    /// strings such as `"10.2.14"`, which can't cleanly become Rust
    /// identifiers), validated at runtime against the known version list
    /// in `data::store::resolve_store_path`/`validation::validator`.
    #[serde(default = "default_api_version")]
    pub api_version: String,
    #[serde(default = "default_log_level")]
    pub log_level: String,
    #[serde(default = "default_rate_limit")]
    pub rate_limit: u32,
    #[serde(default = "default_timeout_ms")]
    pub timeout_ms: u64,
    #[serde(default = "default_cache_size")]
    pub cache_size: u32,
    #[serde(default = "default_retry_attempts")]
    pub retry_attempts: u32,
    #[serde(default = "default_transport")]
    pub transport: Transport,
    #[serde(default = "default_host")]
    pub host: String,
    #[serde(default = "default_port")]
    pub port: u16,
    #[serde(default)]
    pub cors_allow: Option<String>,
}
