/*
 * 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 Plugin {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "version")]
    pub version: String,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "author", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub author: Option<Option<String>>,
    #[serde(rename = "license", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub license: Option<Option<String>>,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "source_type")]
    pub source_type: SourceType,
    #[serde(rename = "source_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub source_url: Option<Option<String>>,
    #[serde(rename = "format_key", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub format_key: Option<Option<String>>,
    #[serde(rename = "capabilities", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub capabilities: Option<Option<serde_json::Value>>,
    #[serde(rename = "resource_limits", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub resource_limits: Option<Option<serde_json::Value>>,
    #[serde(rename = "installed_at")]
    pub installed_at: String,
}

impl Plugin {
    pub fn new(id: uuid::Uuid, name: String, version: String, status: Status, source_type: SourceType, installed_at: String) -> Plugin {
        Plugin {
            id,
            name,
            version,
            description: None,
            author: None,
            license: None,
            status,
            source_type,
            source_url: None,
            format_key: None,
            capabilities: None,
            resource_limits: None,
            installed_at,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "disabled")]
    Disabled,
    #[serde(rename = "error")]
    Error,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SourceType {
    #[serde(rename = "core")]
    Core,
    #[serde(rename = "wasm_git")]
    WasmGit,
    #[serde(rename = "wasm_zip")]
    WasmZip,
    #[serde(rename = "wasm_local")]
    WasmLocal,
}

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

