/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.  ## Authentication  The JSON management API under `/api/v1/_*` accepts **API tokens only as `Authorization: Bearer <token>`**. This is the canonical scheme for programmatic access; JWTs issued by the login flow also use `Bearer`. HTTP Basic credentials on `/api/v1/_*` are validated *only* as a real `username:password` login — the password half is **not** retried as an API token. A request to `/api/v1/_*` that sends an API token in the password field of Basic auth therefore returns `401 AUTH_ERROR`; switch to `Authorization: Bearer <token>`.  Format (package-manager) endpoints such as `/v2/_*` (OCI), `/incus/_*`, `/debian/_*`, and the language registries are intentionally more permissive for client compatibility: in addition to Bearer, they accept HTTP **Basic** auth with the API token supplied in the *password* field (any username), matching the `pip` netrc / Artifactory-style `token:<api_token>` convention used by package managers that cannot send a Bearer header. This Basic-with-token fallback applies to format endpoints only, never to `/api/v1/_*`.
 *
 * The version of the OpenAPI document: 1.4.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OidcConfigResponse {
    /// Opt-in compatibility flag (migration 144): when true the OIDC provider accepts ID tokens signed with RSA keys shorter than 2048 bits via a restricted RS256/384/512 PKCS#1 v1.5 path. Below the OWASP ASVS 4.0 baseline; only enable for legacy IdPs.
    #[serde(rename = "allow_legacy_rsa_keys")]
    pub allow_legacy_rsa_keys: bool,
    #[serde(rename = "attribute_mapping")]
    pub attribute_mapping: serde_json::Value,
    #[serde(rename = "auto_create_users")]
    pub auto_create_users: bool,
    #[serde(rename = "client_id")]
    pub client_id: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "has_secret")]
    pub has_secret: bool,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    #[serde(rename = "issuer_url")]
    pub issuer_url: String,
    #[serde(rename = "map_groups_to_groups")]
    pub map_groups_to_groups: bool,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "pkce_enabled")]
    pub pkce_enabled: bool,
    #[serde(rename = "scopes")]
    pub scopes: Vec<String>,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

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

