use serde::{Deserialize, Serialize}; /*
                                      * Service Control API
                                      *
                                      * Provides admission control and telemetry reporting for services integrated with Service Infrastructure.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::servicecontrol_v1::models;

/// V1LogEntry : An individual log entry.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V1LogEntry {
    #[serde(rename = "httpRequest", skip_serializing_if = "Option::is_none")]
    pub http_request: Option<Box<models::V1HttpRequest>>,
    /// A unique ID for the log entry used for deduplication. If omitted, the implementation will generate one based on operation_id.
    #[serde(rename = "insertId", skip_serializing_if = "Option::is_none")]
    pub insert_id: Option<String>,
    /// A set of user-defined (key, value) data that provides additional information about the log entry.
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// A set of user-defined (key, value) data that provides additional information about the moniotored resource that the log entry belongs to.
    #[serde(
        rename = "monitoredResourceLabels",
        skip_serializing_if = "Option::is_none"
    )]
    pub monitored_resource_labels: Option<std::collections::HashMap<String, String>>,
    /// Required. The log to which this log entry belongs. Examples: `\"syslog\"`, `\"book_log\"`.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "operation", skip_serializing_if = "Option::is_none")]
    pub operation: Option<Box<models::V1LogEntryOperation>>,
    /// The log entry payload, represented as a protocol buffer that is expressed as a JSON object. The only accepted type currently is AuditLog.
    #[serde(rename = "protoPayload", skip_serializing_if = "Option::is_none")]
    pub proto_payload: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The severity of the log entry. The default value is `LogSeverity.DEFAULT`.
    #[serde(rename = "severity", skip_serializing_if = "Option::is_none")]
    pub severity: Option<Severity>,
    #[serde(rename = "sourceLocation", skip_serializing_if = "Option::is_none")]
    pub source_location: Option<Box<models::V1LogEntrySourceLocation>>,
    /// The log entry payload, represented as a structure that is expressed as a JSON object.
    #[serde(rename = "structPayload", skip_serializing_if = "Option::is_none")]
    pub struct_payload: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The log entry payload, represented as a Unicode string (UTF-8).
    #[serde(rename = "textPayload", skip_serializing_if = "Option::is_none")]
    pub text_payload: Option<String>,
    /// The time the event described by the log entry occurred. If omitted, defaults to operation start time.
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<String>,
    /// Optional. Resource name of the trace associated with the log entry, if any. If this field contains a relative resource name, you can assume the name is relative to `//tracing.googleapis.com`. Example: `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
    #[serde(rename = "trace", skip_serializing_if = "Option::is_none")]
    pub trace: Option<String>,
}

impl V1LogEntry {
    /// An individual log entry.
    pub fn new() -> V1LogEntry {
        V1LogEntry {
            http_request: None,
            insert_id: None,
            labels: None,
            monitored_resource_labels: None,
            name: None,
            operation: None,
            proto_payload: None,
            severity: None,
            source_location: None,
            struct_payload: None,
            text_payload: None,
            timestamp: None,
            trace: None,
        }
    }
}
/// The severity of the log entry. The default value is `LogSeverity.DEFAULT`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Severity {
    #[serde(rename = "DEFAULT")]
    Default,
    #[serde(rename = "DEBUG")]
    Debug,
    #[serde(rename = "INFO")]
    Info,
    #[serde(rename = "NOTICE")]
    Notice,
    #[serde(rename = "WARNING")]
    Warning,
    #[serde(rename = "ERROR")]
    Error,
    #[serde(rename = "CRITICAL")]
    Critical,
    #[serde(rename = "ALERT")]
    Alert,
    #[serde(rename = "EMERGENCY")]
    Emergency,
}

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