use serde::{Deserialize, Serialize}; /*
                                      * Firebase Cloud Messaging API
                                      *
                                      * FCM send API that provides a cross-platform messaging solution to reliably deliver messages at no cost.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::fcm_v1::models;

/// AndroidConfig : Android specific options for messages sent through [FCM connection server](https://goo.gl/4GLdUl).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AndroidConfig {
    /// An identifier of a group of messages that can be collapsed, so that only the last message gets sent when delivery can be resumed. A maximum of 4 different collapse keys is allowed at any given time.
    #[serde(rename = "collapseKey", skip_serializing_if = "Option::is_none")]
    pub collapse_key: Option<String>,
    /// Arbitrary key/value payload. If present, it will override google.firebase.fcm.v1.Message.data.
    #[serde(rename = "data", skip_serializing_if = "Option::is_none")]
    pub data: Option<std::collections::HashMap<String, String>>,
    /// If set to true, messages will be allowed to be delivered to the app while the device is in direct boot mode. See [Support Direct Boot mode](https://developer.android.com/training/articles/direct-boot).
    #[serde(rename = "directBootOk", skip_serializing_if = "Option::is_none")]
    pub direct_boot_ok: Option<bool>,
    #[serde(rename = "fcmOptions", skip_serializing_if = "Option::is_none")]
    pub fcm_options: Option<Box<models::AndroidFcmOptions>>,
    #[serde(rename = "notification", skip_serializing_if = "Option::is_none")]
    pub notification: Option<Box<models::AndroidNotification>>,
    /// Message priority. Can take \"normal\" and \"high\" values. For more information, see [Setting the priority of a message](https://goo.gl/GjONJv).
    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
    pub priority: Option<Priority>,
    /// Package name of the application where the registration token must match in order to receive the message.
    #[serde(
        rename = "restrictedPackageName",
        skip_serializing_if = "Option::is_none"
    )]
    pub restricted_package_name: Option<String>,
    /// How long (in seconds) the message should be kept in FCM storage if the device is offline. The maximum time to live supported is 4 weeks, and the default value is 4 weeks if not set. Set it to 0 if want to send the message immediately. In JSON format, the Duration type is encoded as a string rather than an object, where the string ends in the suffix \"s\" (indicating seconds) and is preceded by the number of seconds, with nanoseconds expressed as fractional seconds. For example, 3 seconds with 0 nanoseconds should be encoded in JSON format as \"3s\", while 3 seconds and 1 nanosecond should be expressed in JSON format as \"3.000000001s\". The ttl will be rounded down to the nearest second.
    #[serde(rename = "ttl", skip_serializing_if = "Option::is_none")]
    pub ttl: Option<String>,
}

impl AndroidConfig {
    /// Android specific options for messages sent through [FCM connection server](https://goo.gl/4GLdUl).
    pub fn new() -> AndroidConfig {
        AndroidConfig {
            collapse_key: None,
            data: None,
            direct_boot_ok: None,
            fcm_options: None,
            notification: None,
            priority: None,
            restricted_package_name: None,
            ttl: None,
        }
    }
}
/// Message priority. Can take \"normal\" and \"high\" values. For more information, see [Setting the priority of a message](https://goo.gl/GjONJv).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Priority {
    #[serde(rename = "NORMAL")]
    Normal,
    #[serde(rename = "HIGH")]
    High,
}

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