/*
 * 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 TargetingSpecCitiesInner {
    #[serde(rename = "key")]
    pub key: String,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Radius around the city. Requires distanceUnit.
    #[serde(rename = "radius", skip_serializing_if = "Option::is_none")]
    pub radius: Option<f64>,
    /// Required if radius is set.
    #[serde(rename = "distanceUnit", skip_serializing_if = "Option::is_none")]
    pub distance_unit: Option<DistanceUnit>,
}

impl TargetingSpecCitiesInner {
    pub fn new(key: String) -> TargetingSpecCitiesInner {
        TargetingSpecCitiesInner {
            key,
            name: None,
            radius: None,
            distance_unit: None,
        }
    }
}
/// Required if radius is set.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DistanceUnit {
    #[serde(rename = "mile")]
    Mile,
    #[serde(rename = "kilometer")]
    Kilometer,
}

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