/*
 * 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};

/// OAuthApplicationResponse : Serializer for OAuth application responses
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OAuthApplicationResponse {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
    pub client_id: Option<String>,
    #[serde(rename = "client_secret")]
    pub client_secret: String,
    /// * `confidential` - Confidential * `public` - Public
    #[serde(rename = "client_type")]
    pub client_type: ClientType,
    /// * `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")]
    pub authorization_grant_type: AuthorizationGrantType,
    #[serde(rename = "created")]
    pub created: chrono::DateTime<chrono::FixedOffset>,
    #[serde(rename = "updated")]
    pub updated: chrono::DateTime<chrono::FixedOffset>,
}

impl OAuthApplicationResponse {
    /// Serializer for OAuth application responses
    pub fn new(id: uuid::Uuid, client_secret: String, client_type: ClientType, authorization_grant_type: AuthorizationGrantType, created: chrono::DateTime<chrono::FixedOffset>, updated: chrono::DateTime<chrono::FixedOffset>) -> OAuthApplicationResponse {
        OAuthApplicationResponse {
            id,
            name: None,
            client_id: None,
            client_secret,
            client_type,
            authorization_grant_type,
            created,
            updated,
        }
    }
}
/// * `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
    }
}
/// * `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
    }
}

