/*
 * 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 SamlConfigResponse {
    #[serde(rename = "admin_group", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub admin_group: Option<Option<String>>,
    #[serde(rename = "attribute_mapping")]
    pub attribute_mapping: serde_json::Value,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "entity_id")]
    pub entity_id: String,
    #[serde(rename = "has_certificate")]
    pub has_certificate: bool,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "name_id_format")]
    pub name_id_format: String,
    #[serde(rename = "require_signed_assertions")]
    pub require_signed_assertions: bool,
    #[serde(rename = "sign_requests")]
    pub sign_requests: bool,
    #[serde(rename = "slo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub slo_url: Option<Option<String>>,
    #[serde(rename = "sp_entity_id")]
    pub sp_entity_id: String,
    #[serde(rename = "sso_url")]
    pub sso_url: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    /// Opt-in flag (see migration 139): when true, the SAML AuthnRequest emits an absolute ACS URL. Defaults to false so existing providers keep their pre-138 wire format.
    #[serde(rename = "use_absolute_acs_url")]
    pub use_absolute_acs_url: bool,
}

impl SamlConfigResponse {
    pub fn new(attribute_mapping: serde_json::Value, created_at: String, entity_id: String, has_certificate: bool, id: uuid::Uuid, is_enabled: bool, name: String, name_id_format: String, require_signed_assertions: bool, sign_requests: bool, sp_entity_id: String, sso_url: String, updated_at: String, use_absolute_acs_url: bool) -> SamlConfigResponse {
        SamlConfigResponse {
            admin_group: None,
            attribute_mapping,
            created_at,
            entity_id,
            has_certificate,
            id,
            is_enabled,
            name,
            name_id_format,
            require_signed_assertions,
            sign_requests,
            slo_url: None,
            sp_entity_id,
            sso_url,
            updated_at,
            use_absolute_acs_url,
        }
    }
}

