/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// AlertState : Alert state for a service.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AlertState {
    #[serde(rename = "consecutive_failures")]
    pub consecutive_failures: i32,
    #[serde(rename = "current_status")]
    pub current_status: String,
    #[serde(rename = "last_alert_sent_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_alert_sent_at: Option<Option<String>>,
    #[serde(rename = "service_name")]
    pub service_name: String,
    #[serde(rename = "suppressed_until", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub suppressed_until: Option<Option<String>>,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl AlertState {
    /// Alert state for a service.
    pub fn new(consecutive_failures: i32, current_status: String, service_name: String, updated_at: String) -> AlertState {
        AlertState {
            consecutive_failures,
            current_status,
            last_alert_sent_at: None,
            service_name,
            suppressed_until: None,
            updated_at,
        }
    }
}

