/*
 * 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 WebhookDelivery {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "webhook_id")]
    pub webhook_id: uuid::Uuid,
    #[serde(rename = "event")]
    pub event: String,
    #[serde(rename = "status_code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub status_code: Option<Option<i32>>,
    #[serde(rename = "request_body")]
    pub request_body: String,
    #[serde(rename = "response_body", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub response_body: Option<Option<String>>,
    #[serde(rename = "delivered_at")]
    pub delivered_at: String,
    #[serde(rename = "success")]
    pub success: bool,
}

impl WebhookDelivery {
    pub fn new(id: uuid::Uuid, webhook_id: uuid::Uuid, event: String, request_body: String, delivered_at: String, success: bool) -> WebhookDelivery {
        WebhookDelivery {
            id,
            webhook_id,
            event,
            status_code: None,
            request_body,
            response_body: None,
            delivered_at,
            success,
        }
    }
}

