/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ListLogs200ResponseLogsInner {
    /// Log category (publishing, connections, webhooks, messaging)
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<String>,
    /// Specific action (post.published, message.sent, account.connected, etc.)
    #[serde(rename = "action", skip_serializing_if = "Option::is_none")]
    pub action: Option<String>,
    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<String>,
    #[serde(rename = "account_id", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    #[serde(rename = "status_code", skip_serializing_if = "Option::is_none")]
    pub status_code: Option<i32>,
    #[serde(rename = "error_message", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    #[serde(rename = "error_code", skip_serializing_if = "Option::is_none")]
    pub error_code: Option<String>,
    #[serde(rename = "duration_ms", skip_serializing_if = "Option::is_none")]
    pub duration_ms: Option<i32>,
    /// The API endpoint that triggered this log
    #[serde(rename = "endpoint", skip_serializing_if = "Option::is_none")]
    pub endpoint: Option<String>,
    /// Request JSON (truncated to 5KB)
    #[serde(rename = "request_body", skip_serializing_if = "Option::is_none")]
    pub request_body: Option<String>,
    /// Response JSON (truncated to 10KB)
    #[serde(rename = "response_body", skip_serializing_if = "Option::is_none")]
    pub response_body: Option<String>,
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    /// Additional context as JSON string
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<String>,
    /// Correlation ID linking every log from one API request (api_request logs)
    #[serde(rename = "request_id", skip_serializing_if = "Option::is_none")]
    pub request_id: Option<String>,
    /// The API key that made the request (api_request logs)
    #[serde(rename = "api_key_id", skip_serializing_if = "Option::is_none")]
    pub api_key_id: Option<String>,
    /// HTTP method (api_request logs)
    #[serde(rename = "method", skip_serializing_if = "Option::is_none")]
    pub method: Option<String>,
    /// Request path (api_request logs)
    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
    pub path: Option<String>,
    /// Client IP address (api_request logs)
    #[serde(rename = "ip_address", skip_serializing_if = "Option::is_none")]
    pub ip_address: Option<String>,
    /// Client user-agent (api_request logs)
    #[serde(rename = "user_agent", skip_serializing_if = "Option::is_none")]
    pub user_agent: Option<String>,
}

impl ListLogs200ResponseLogsInner {
    pub fn new() -> ListLogs200ResponseLogsInner {
        ListLogs200ResponseLogsInner {
            r#type: None,
            action: None,
            user_id: None,
            platform: None,
            account_id: None,
            status: None,
            status_code: None,
            error_message: None,
            error_code: None,
            duration_ms: None,
            endpoint: None,
            request_body: None,
            response_body: None,
            created_at: None,
            metadata: None,
            request_id: None,
            api_key_id: None,
            method: None,
            path: None,
            ip_address: None,
            user_agent: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "success")]
    Success,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "skipped")]
    Skipped,
}

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