/*
 * 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 FormatHandler {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "format_key")]
    pub format_key: String,
    #[serde(rename = "handler_type")]
    pub handler_type: HandlerType,
    #[serde(rename = "display_name")]
    pub display_name: String,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "extensions")]
    pub extensions: Vec<String>,
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    #[serde(rename = "plugin_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub plugin_id: Option<Option<uuid::Uuid>>,
}

impl FormatHandler {
    pub fn new(id: uuid::Uuid, format_key: String, handler_type: HandlerType, display_name: String, extensions: Vec<String>, is_enabled: bool) -> FormatHandler {
        FormatHandler {
            id,
            format_key,
            handler_type,
            display_name,
            description: None,
            extensions,
            is_enabled,
            plugin_id: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum HandlerType {
    #[serde(rename = "core")]
    Core,
    #[serde(rename = "wasm")]
    Wasm,
}

impl Default for HandlerType {
    fn default() -> HandlerType {
        Self::Core
    }
}

