/*
 * 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 CreateStandaloneAdRequestCitiesInner {
    /// Meta city ID, from /v1/ads/targeting/search results.
    #[serde(rename = "key")]
    pub key: String,
    /// Optional radius around the city. Must be set together with distance_unit.
    #[serde(rename = "radius", skip_serializing_if = "Option::is_none")]
    pub radius: Option<f64>,
    /// Unit for radius. Required if radius is set.
    #[serde(rename = "distance_unit", skip_serializing_if = "Option::is_none")]
    pub distance_unit: Option<DistanceUnit>,
}

impl CreateStandaloneAdRequestCitiesInner {
    pub fn new(key: String) -> CreateStandaloneAdRequestCitiesInner {
        CreateStandaloneAdRequestCitiesInner {
            key,
            radius: None,
            distance_unit: None,
        }
    }
}
/// Unit for radius. 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
    }
}
