/*
 * Artifact Keeper API
 *
 * REST API for Artifact Keeper, an open-source universal artifact registry. Covers user management, repositories, artifacts, search, security scanning, SBOM, dependency tracking, SSO, analytics, monitoring, telemetry, lifecycle policies, plugins, edge nodes, migration, and administration. Format-specific protocol endpoints (npm, PyPI, Maven, Docker/OCI, etc.) are not included; those follow their respective upstream specifications.
 *
 * The version of the OpenAPI document: 1.0.0-a2
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SigningKey {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "key_type")]
    pub key_type: KeyType,
    #[serde(rename = "fingerprint")]
    pub fingerprint: String,
    #[serde(rename = "repository_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub repository_id: Option<Option<uuid::Uuid>>,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<Option<String>>,
}

impl SigningKey {
    pub fn new(id: uuid::Uuid, name: String, key_type: KeyType, fingerprint: String, status: Status, created_at: String) -> SigningKey {
        SigningKey {
            id,
            name,
            key_type,
            fingerprint,
            repository_id: None,
            status,
            created_at,
            expires_at: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KeyType {
    #[serde(rename = "rsa")]
    Rsa,
    #[serde(rename = "gpg")]
    Gpg,
}

impl Default for KeyType {
    fn default() -> KeyType {
        Self::Rsa
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "revoked")]
    Revoked,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}

