/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// SystemConfigResponse : Public runtime configuration values.  This response intentionally omits all secrets, credentials, and internal connection strings. Only values useful for UI/client behavior are included.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SystemConfigResponse {
    /// Authentication provider availability.
    #[serde(rename = "auth")]
    pub auth: Box<models::AuthConfig>,
    /// Whether the instance is running in demo mode (writes blocked).
    #[serde(rename = "demo_mode")]
    pub demo_mode: bool,
    /// Whether anonymous (unauthenticated) access is permitted at all (issue #850). When `false`, the server rejects all unauthenticated requests except for the login, setup, health, and OCI challenge endpoints. Frontends should hide UI affordances that imply public access (e.g. the \"public repo\" toggle) and redirect unauthenticated users to the login page.
    #[serde(rename = "guest_access_enabled")]
    pub guest_access_enabled: bool,
    /// Maximum upload size in bytes (0 means no limit).
    #[serde(rename = "max_upload_size_bytes")]
    pub max_upload_size_bytes: i64,
    /// OIDC issuer URL, if configured. This is public information needed by clients to initiate the OIDC flow.
    #[serde(rename = "oidc_issuer", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub oidc_issuer: Option<Option<String>>,
    /// Fine-grained permissions enforcement status. Permission rules can be managed via /api/v1/permissions and are actively enforced.
    #[serde(rename = "permissions")]
    pub permissions: Box<models::PermissionsConfig>,
    /// Plugin signature-verification (supply-chain) policy status.
    #[serde(rename = "plugin_signing")]
    pub plugin_signing: Box<models::PluginSigningConfig>,
    /// Scanner availability.
    #[serde(rename = "scanners")]
    pub scanners: Box<models::ScannersConfig>,
    /// Search engine type: \"opensearch\" when configured, \"database\" otherwise.
    #[serde(rename = "search_engine")]
    pub search_engine: String,
    /// Storage backend type (e.g. \"filesystem\", \"s3\", \"gcs\", \"azure\").
    #[serde(rename = "storage_backend")]
    pub storage_backend: String,
}

impl SystemConfigResponse {
    /// Public runtime configuration values.  This response intentionally omits all secrets, credentials, and internal connection strings. Only values useful for UI/client behavior are included.
    pub fn new(auth: models::AuthConfig, demo_mode: bool, guest_access_enabled: bool, max_upload_size_bytes: i64, permissions: models::PermissionsConfig, plugin_signing: models::PluginSigningConfig, scanners: models::ScannersConfig, search_engine: String, storage_backend: String) -> SystemConfigResponse {
        SystemConfigResponse {
            auth: Box::new(auth),
            demo_mode,
            guest_access_enabled,
            max_upload_size_bytes,
            oidc_issuer: None,
            permissions: Box::new(permissions),
            plugin_signing: Box::new(plugin_signing),
            scanners: Box::new(scanners),
            search_engine,
            storage_backend,
        }
    }
}

