use crate::types::{Bounds, LatLng, LocationType};
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Geometry {
pub location: LatLng,
#[serde(default)]
pub location_type: Option<LocationType>,
pub viewport: Bounds,
#[serde(default)]
pub bounds: Option<Bounds>,
}
impl Geometry {
#[must_use]
pub fn get_bounds_southwest_lat(&self) -> Option<Decimal> {
self.bounds.as_ref().map(|bounds| bounds.southwest.lat)
}
#[must_use]
pub fn get_bounds_southwest_lng(&self) -> Option<Decimal> {
self.bounds.as_ref().map(|bounds| bounds.southwest.lng)
}
#[must_use]
pub fn get_bounds_northeast_lat(&self) -> Option<Decimal> {
self.bounds.as_ref().map(|bounds| bounds.northeast.lat)
}
#[must_use]
pub fn get_bounds_northeast_lng(&self) -> Option<Decimal> {
self.bounds.as_ref().map(|bounds| bounds.northeast.lng)
} }