/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ApiKey {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "keyPreview", skip_serializing_if = "Option::is_none")]
    pub key_preview: Option<String>,
    #[serde(rename = "expiresAt", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<String>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    /// Returned only once, on creation
    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// 'full' grants access to all profiles, 'profiles' restricts to specific profiles
    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
    pub scope: Option<Scope>,
    /// Profiles this key can access (populated with name and color). Only present when scope is 'profiles'.
    #[serde(rename = "profileIds", skip_serializing_if = "Option::is_none")]
    pub profile_ids: Option<Vec<models::ApiKeyProfileIdsInner>>,
    /// 'read-write' allows all operations, 'read' restricts to GET requests only
    #[serde(rename = "permission", skip_serializing_if = "Option::is_none")]
    pub permission: Option<Permission>,
}

impl ApiKey {
    pub fn new() -> ApiKey {
        ApiKey {
            id: None,
            name: None,
            key_preview: None,
            expires_at: None,
            created_at: None,
            key: None,
            scope: None,
            profile_ids: None,
            permission: None,
        }
    }
}
/// 'full' grants access to all profiles, 'profiles' restricts to specific profiles
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Scope {
    #[serde(rename = "full")]
    Full,
    #[serde(rename = "profiles")]
    Profiles,
}

impl Default for Scope {
    fn default() -> Scope {
        Self::Full
    }
}
/// 'read-write' allows all operations, 'read' restricts to GET requests only
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Permission {
    #[serde(rename = "read-write")]
    ReadWrite,
    #[serde(rename = "read")]
    Read,
}

impl Default for Permission {
    fn default() -> Permission {
        Self::ReadWrite
    }
}
