/*
 * Artifact Keeper API
 *
 * REST API for Artifact Keeper, an open-source universal artifact registry. Covers user management, repositories, artifacts, search, security scanning, SBOM, dependency tracking, SSO, analytics, monitoring, telemetry, lifecycle policies, plugins, edge nodes, migration, and administration. Format-specific protocol endpoints (npm, PyPI, Maven, Docker/OCI, etc.) are not included; those follow their respective upstream specifications.
 *
 * The version of the OpenAPI document: 1.0.0-a2
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OidcConfigResponse {
    /// OIDC configuration UUID
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Display name for the OIDC provider
    #[serde(rename = "name")]
    pub name: String,
    /// OIDC issuer URL for discovery
    #[serde(rename = "issuer_url")]
    pub issuer_url: String,
    /// OAuth2 client identifier
    #[serde(rename = "client_id")]
    pub client_id: String,
    /// Whether a client secret has been configured
    #[serde(rename = "has_secret")]
    pub has_secret: bool,
    /// OAuth2 scopes to request
    #[serde(rename = "scopes")]
    pub scopes: Vec<String>,
    /// Mapping of OIDC claims to user attributes
    #[serde(rename = "attribute_mapping")]
    pub attribute_mapping: serde_json::Value,
    /// Whether this OIDC configuration is active
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    /// Whether to automatically create user accounts on first login
    #[serde(rename = "auto_create_users")]
    pub auto_create_users: bool,
    /// Timestamp when the configuration was created
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Timestamp when the configuration was last modified
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl OidcConfigResponse {
    pub fn new(id: uuid::Uuid, name: String, issuer_url: String, client_id: String, has_secret: bool, scopes: Vec<String>, attribute_mapping: serde_json::Value, is_enabled: bool, auto_create_users: bool, created_at: String, updated_at: String) -> OidcConfigResponse {
        OidcConfigResponse {
            id,
            name,
            issuer_url,
            client_id,
            has_secret,
            scopes,
            attribute_mapping,
            is_enabled,
            auto_create_users,
            created_at,
            updated_at,
        }
    }
}

