/*
 * Pescheck API
 *
 * Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
 *
 * The version of the OpenAPI document: 2.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// OAuthApplication : Serializer for OAuth application creation requests
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OAuthApplication {
    /// Name for the OAuth application
    #[serde(rename = "name")]
    pub name: String,
    /// Client type (confidential recommended for server-to-server)  * `confidential` - Confidential * `public` - Public
    #[serde(rename = "client_type", skip_serializing_if = "Option::is_none")]
    pub client_type: Option<ClientType>,
    /// Grant type (client_credentials for API access)  * `authorization-code` - Authorization code * `implicit` - Implicit * `password` - Resource owner password-based * `client-credentials` - Client credentials * `openid-hybrid` - OpenID connect hybrid
    #[serde(rename = "authorization_grant_type", skip_serializing_if = "Option::is_none")]
    pub authorization_grant_type: Option<AuthorizationGrantType>,
    /// Space-separated redirect URIs (optional for client_credentials)
    #[serde(rename = "redirect_uris", skip_serializing_if = "Option::is_none")]
    pub redirect_uris: Option<String>,
    /// Division ID to create application for (optional)
    #[serde(rename = "division_id", skip_serializing_if = "Option::is_none")]
    pub division_id: Option<uuid::Uuid>,
}

impl OAuthApplication {
    /// Serializer for OAuth application creation requests
    pub fn new(name: String) -> OAuthApplication {
        OAuthApplication {
            name,
            client_type: None,
            authorization_grant_type: None,
            redirect_uris: None,
            division_id: None,
        }
    }
}
/// Client type (confidential recommended for server-to-server)  * `confidential` - Confidential * `public` - Public
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ClientType {
    #[serde(rename = "confidential")]
    Confidential,
    #[serde(rename = "public")]
    Public,
}

impl Default for ClientType {
    fn default() -> ClientType {
        Self::Confidential
    }
}
/// Grant type (client_credentials for API access)  * `authorization-code` - Authorization code * `implicit` - Implicit * `password` - Resource owner password-based * `client-credentials` - Client credentials * `openid-hybrid` - OpenID connect hybrid
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AuthorizationGrantType {
    #[serde(rename = "authorization-code")]
    AuthorizationCode,
    #[serde(rename = "implicit")]
    Implicit,
    #[serde(rename = "password")]
    Password,
    #[serde(rename = "client-credentials")]
    ClientCredentials,
    #[serde(rename = "openid-hybrid")]
    OpenidHybrid,
}

impl Default for AuthorizationGrantType {
    fn default() -> AuthorizationGrantType {
        Self::AuthorizationCode
    }
}

