/*
 * Websocket Subscription Schemas
 *
 * Schema definitions Websocket API subscriptions for Thalex exchange.
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Banner {
    /// The id of this banner.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<rust_decimal::Decimal>,
    /// Time when this banner was posted (Unix timestamp).
    #[serde(rename = "time")]
    pub time: rust_decimal::Decimal,
    /// Severity of the banner message. Used to choose appropriate styling for banner display.
    #[serde(rename = "severity")]
    pub severity: Severity,
    /// Optional title of the banner.
    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// Message text to be displayed in the banner.
    #[serde(rename = "message")]
    pub message: String,
}

impl Banner {
    pub fn new(time: rust_decimal::Decimal, severity: Severity, message: String) -> Banner {
        Banner {
            id: None,
            time,
            severity,
            title: None,
            message,
        }
    }
}
/// Severity of the banner message. Used to choose appropriate styling for banner display.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Severity {
    #[serde(rename = "info")]
    Info,
    #[serde(rename = "warning")]
    Warning,
    #[serde(rename = "critical")]
    Critical,
}

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