use serde::Deserialize;

/// A latitude/longitude coordinate used in confidence area polygons.
#[derive(Debug, Clone, Deserialize)]
pub struct GeoPoint {
    pub latitude: f64,
    pub longitude: f64,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Currency {
    pub numeric_code: Option<i32>,
    pub code: Option<String>,
    pub name: Option<String>,
    pub iso_name: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct WBClassification {
    pub id: Option<String>,
    pub value: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CountryInfo {
    pub iso_alpha2: Option<String>,
    pub iso_alpha3: Option<String>,
    pub m49_code: Option<i32>,
    pub name: Option<String>,
    pub iso_name: Option<String>,
    pub iso_name_full: Option<String>,
    pub un_region: Option<String>,
    pub calling_code: Option<String>,
    pub country_flag_emoji: Option<String>,
    pub currency: Option<Currency>,
    pub wb_region: Option<WBClassification>,
    pub wb_income_level: Option<WBClassification>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Location {
    pub continent: Option<String>,
    pub continent_code: Option<String>,
    pub is_european_union: Option<bool>,
    pub city: Option<String>,
    #[serde(rename = "localityName")]
    pub locality: Option<String>,
    pub postcode: Option<String>,
    pub plus_code: Option<String>,
    pub principal_subdivision: Option<String>,
    pub principal_subdivision_code: Option<String>,
    pub country_name: Option<String>,
    pub country_code: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdministrativeArea {
    pub name: Option<String>,
    pub description: Option<String>,
    pub iso_name: Option<String>,
    pub iso_code: Option<String>,
    pub admin_level: Option<i32>,
    pub order: Option<i32>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct LocalityInfo {
    pub administrative: Option<Vec<AdministrativeArea>>,
    pub informative: Option<Vec<AdministrativeArea>>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Carrier {
    pub asn: Option<String>,
    pub asn_numeric: Option<i64>,
    pub organisation: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Network {
    pub registry: Option<String>,
    pub registry_status: Option<String>,
    pub registered_country: Option<String>,
    pub registered_country_name: Option<String>,
    pub organisation: Option<String>,
    pub bgp_prefix: Option<String>,
    pub asn: Option<String>,
    pub is_bogon: Option<bool>,
    pub carriers: Option<Vec<Carrier>>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TimezoneResponse {
    pub iana_time_id: Option<String>,
    pub display_name: Option<String>,
    pub utc_offset: Option<String>,
    pub utc_offset_seconds: Option<i32>,
    pub is_daylight_saving_time: Option<bool>,
    pub local_time: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct UserRisk {
    pub risk: Option<String>,
    pub description: Option<String>,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct HazardReport {
    pub is_known_as_tor_server: Option<bool>,
    pub is_known_as_vpn: Option<bool>,
    pub is_known_as_proxy: Option<bool>,
    pub is_known_as_datacenter: Option<bool>,
    pub is_known_as_bot: Option<bool>,
    pub is_spamhaus_drop: Option<bool>,
    pub is_spamhaus_edrop: Option<bool>,
    pub is_spamhaus_asn_drop: Option<bool>,
    pub is_blacklisted_uceprotect: Option<bool>,
    pub is_blacklisted_blocklist_de: Option<bool>,
    pub is_blacklisted_aa_tools: Option<bool>,
    pub hosting_likelihood: Option<i32>,
    pub is_hosting_asn: Option<bool>,
    pub is_cellular: Option<bool>,
    pub security_threat: Option<String>,
    pub user_risk: Option<UserRisk>,
}
