/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.  ## Authentication  The JSON management API under `/api/v1/_*` accepts **API tokens only as `Authorization: Bearer <token>`**. This is the canonical scheme for programmatic access; JWTs issued by the login flow also use `Bearer`. HTTP Basic credentials on `/api/v1/_*` are validated *only* as a real `username:password` login — the password half is **not** retried as an API token. A request to `/api/v1/_*` that sends an API token in the password field of Basic auth therefore returns `401 AUTH_ERROR`; switch to `Authorization: Bearer <token>`.  Format (package-manager) endpoints such as `/v2/_*` (OCI), `/incus/_*`, `/debian/_*`, and the language registries are intentionally more permissive for client compatibility: in addition to Bearer, they accept HTTP **Basic** auth with the API token supplied in the *password* field (any username), matching the `pip` netrc / Artifactory-style `token:<api_token>` convention used by package managers that cannot send a Bearer header. This Basic-with-token fallback applies to format endpoints only, never to `/api/v1/_*`.
 *
 * The version of the OpenAPI document: 1.4.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// WasmPluginResponse : WASM plugin response with extended fields
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WasmPluginResponse {
    #[serde(rename = "author", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub author: Option<Option<String>>,
    #[serde(rename = "capabilities")]
    pub capabilities: serde_json::Value,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "display_name")]
    pub display_name: String,
    #[serde(rename = "enabled_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub enabled_at: Option<Option<String>>,
    #[serde(rename = "homepage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub homepage: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "installed_at")]
    pub installed_at: String,
    #[serde(rename = "license", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub license: Option<Option<String>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "plugin_type")]
    pub plugin_type: String,
    #[serde(rename = "resource_limits")]
    pub resource_limits: serde_json::Value,
    #[serde(rename = "source_ref", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub source_ref: Option<Option<String>>,
    #[serde(rename = "source_type")]
    pub source_type: String,
    #[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 = "status")]
    pub status: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "version")]
    pub version: String,
}

impl WasmPluginResponse {
    /// WASM plugin response with extended fields
    pub fn new(capabilities: serde_json::Value, display_name: String, id: uuid::Uuid, installed_at: String, name: String, plugin_type: String, resource_limits: serde_json::Value, source_type: String, status: String, updated_at: String, version: String) -> WasmPluginResponse {
        WasmPluginResponse {
            author: None,
            capabilities,
            description: None,
            display_name,
            enabled_at: None,
            homepage: None,
            id,
            installed_at,
            license: None,
            name,
            plugin_type,
            resource_limits,
            source_ref: None,
            source_type,
            source_url: None,
            status,
            updated_at,
            version,
        }
    }
}

