/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.2.0
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AzureKeyVaultSettings {
    /// Azure Key Vault URL (e.g., https://myvault.vault.azure.net)
    #[serde(rename = "vault_url")]
    pub vault_url: String,
    /// Azure AD tenant ID
    #[serde(rename = "tenant_id")]
    pub tenant_id: String,
    /// Azure AD application (client) ID
    #[serde(rename = "client_id")]
    pub client_id: String,
    /// Azure AD client secret. Optional — when omitted, the integration falls back to Azure Workload Identity Federation, exchanging the Kubernetes-projected service-account JWT at AZURE_FEDERATED_TOKEN_FILE for an access token (no long-lived secret stored).
    #[serde(rename = "client_secret", skip_serializing_if = "Option::is_none")]
    pub client_secret: Option<String>,
    /// Static Bearer token for testing/development (optional, if provided this is used instead of OAuth2 authentication)
    #[serde(rename = "token", skip_serializing_if = "Option::is_none")]
    pub token: Option<String>,
}

impl AzureKeyVaultSettings {
    pub fn new(vault_url: String, tenant_id: String, client_id: String) -> AzureKeyVaultSettings {
        AzureKeyVaultSettings {
            vault_url,
            tenant_id,
            client_id,
            client_secret: None,
            token: None,
        }
    }
}

