{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.Types.GeospatialCoordinateBounds
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.GeospatialCoordinateBounds where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The bound options (north, south, west, east) of the geospatial window
-- options.
--
-- /See:/ 'newGeospatialCoordinateBounds' smart constructor.
data GeospatialCoordinateBounds = GeospatialCoordinateBounds'
  { -- | The latitude of the north bound of the geospatial coordinate bounds.
    GeospatialCoordinateBounds -> Double
north :: Prelude.Double,
    -- | The latitude of the south bound of the geospatial coordinate bounds.
    GeospatialCoordinateBounds -> Double
south :: Prelude.Double,
    -- | The longitude of the west bound of the geospatial coordinate bounds.
    GeospatialCoordinateBounds -> Double
west :: Prelude.Double,
    -- | The longitude of the east bound of the geospatial coordinate bounds.
    GeospatialCoordinateBounds -> Double
east :: Prelude.Double
  }
  deriving (GeospatialCoordinateBounds -> GeospatialCoordinateBounds -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeospatialCoordinateBounds -> GeospatialCoordinateBounds -> Bool
$c/= :: GeospatialCoordinateBounds -> GeospatialCoordinateBounds -> Bool
== :: GeospatialCoordinateBounds -> GeospatialCoordinateBounds -> Bool
$c== :: GeospatialCoordinateBounds -> GeospatialCoordinateBounds -> Bool
Prelude.Eq, ReadPrec [GeospatialCoordinateBounds]
ReadPrec GeospatialCoordinateBounds
Int -> ReadS GeospatialCoordinateBounds
ReadS [GeospatialCoordinateBounds]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeospatialCoordinateBounds]
$creadListPrec :: ReadPrec [GeospatialCoordinateBounds]
readPrec :: ReadPrec GeospatialCoordinateBounds
$creadPrec :: ReadPrec GeospatialCoordinateBounds
readList :: ReadS [GeospatialCoordinateBounds]
$creadList :: ReadS [GeospatialCoordinateBounds]
readsPrec :: Int -> ReadS GeospatialCoordinateBounds
$creadsPrec :: Int -> ReadS GeospatialCoordinateBounds
Prelude.Read, Int -> GeospatialCoordinateBounds -> ShowS
[GeospatialCoordinateBounds] -> ShowS
GeospatialCoordinateBounds -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeospatialCoordinateBounds] -> ShowS
$cshowList :: [GeospatialCoordinateBounds] -> ShowS
show :: GeospatialCoordinateBounds -> String
$cshow :: GeospatialCoordinateBounds -> String
showsPrec :: Int -> GeospatialCoordinateBounds -> ShowS
$cshowsPrec :: Int -> GeospatialCoordinateBounds -> ShowS
Prelude.Show, forall x.
Rep GeospatialCoordinateBounds x -> GeospatialCoordinateBounds
forall x.
GeospatialCoordinateBounds -> Rep GeospatialCoordinateBounds x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GeospatialCoordinateBounds x -> GeospatialCoordinateBounds
$cfrom :: forall x.
GeospatialCoordinateBounds -> Rep GeospatialCoordinateBounds x
Prelude.Generic)

-- |
-- Create a value of 'GeospatialCoordinateBounds' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'north', 'geospatialCoordinateBounds_north' - The latitude of the north bound of the geospatial coordinate bounds.
--
-- 'south', 'geospatialCoordinateBounds_south' - The latitude of the south bound of the geospatial coordinate bounds.
--
-- 'west', 'geospatialCoordinateBounds_west' - The longitude of the west bound of the geospatial coordinate bounds.
--
-- 'east', 'geospatialCoordinateBounds_east' - The longitude of the east bound of the geospatial coordinate bounds.
newGeospatialCoordinateBounds ::
  -- | 'north'
  Prelude.Double ->
  -- | 'south'
  Prelude.Double ->
  -- | 'west'
  Prelude.Double ->
  -- | 'east'
  Prelude.Double ->
  GeospatialCoordinateBounds
newGeospatialCoordinateBounds :: Double -> Double -> Double -> Double -> GeospatialCoordinateBounds
newGeospatialCoordinateBounds
  Double
pNorth_
  Double
pSouth_
  Double
pWest_
  Double
pEast_ =
    GeospatialCoordinateBounds'
      { $sel:north:GeospatialCoordinateBounds' :: Double
north = Double
pNorth_,
        $sel:south:GeospatialCoordinateBounds' :: Double
south = Double
pSouth_,
        $sel:west:GeospatialCoordinateBounds' :: Double
west = Double
pWest_,
        $sel:east:GeospatialCoordinateBounds' :: Double
east = Double
pEast_
      }

-- | The latitude of the north bound of the geospatial coordinate bounds.
geospatialCoordinateBounds_north :: Lens.Lens' GeospatialCoordinateBounds Prelude.Double
geospatialCoordinateBounds_north :: Lens' GeospatialCoordinateBounds Double
geospatialCoordinateBounds_north = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialCoordinateBounds' {Double
north :: Double
$sel:north:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
north} -> Double
north) (\s :: GeospatialCoordinateBounds
s@GeospatialCoordinateBounds' {} Double
a -> GeospatialCoordinateBounds
s {$sel:north:GeospatialCoordinateBounds' :: Double
north = Double
a} :: GeospatialCoordinateBounds)

-- | The latitude of the south bound of the geospatial coordinate bounds.
geospatialCoordinateBounds_south :: Lens.Lens' GeospatialCoordinateBounds Prelude.Double
geospatialCoordinateBounds_south :: Lens' GeospatialCoordinateBounds Double
geospatialCoordinateBounds_south = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialCoordinateBounds' {Double
south :: Double
$sel:south:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
south} -> Double
south) (\s :: GeospatialCoordinateBounds
s@GeospatialCoordinateBounds' {} Double
a -> GeospatialCoordinateBounds
s {$sel:south:GeospatialCoordinateBounds' :: Double
south = Double
a} :: GeospatialCoordinateBounds)

-- | The longitude of the west bound of the geospatial coordinate bounds.
geospatialCoordinateBounds_west :: Lens.Lens' GeospatialCoordinateBounds Prelude.Double
geospatialCoordinateBounds_west :: Lens' GeospatialCoordinateBounds Double
geospatialCoordinateBounds_west = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialCoordinateBounds' {Double
west :: Double
$sel:west:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
west} -> Double
west) (\s :: GeospatialCoordinateBounds
s@GeospatialCoordinateBounds' {} Double
a -> GeospatialCoordinateBounds
s {$sel:west:GeospatialCoordinateBounds' :: Double
west = Double
a} :: GeospatialCoordinateBounds)

-- | The longitude of the east bound of the geospatial coordinate bounds.
geospatialCoordinateBounds_east :: Lens.Lens' GeospatialCoordinateBounds Prelude.Double
geospatialCoordinateBounds_east :: Lens' GeospatialCoordinateBounds Double
geospatialCoordinateBounds_east = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialCoordinateBounds' {Double
east :: Double
$sel:east:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
east} -> Double
east) (\s :: GeospatialCoordinateBounds
s@GeospatialCoordinateBounds' {} Double
a -> GeospatialCoordinateBounds
s {$sel:east:GeospatialCoordinateBounds' :: Double
east = Double
a} :: GeospatialCoordinateBounds)

instance Data.FromJSON GeospatialCoordinateBounds where
  parseJSON :: Value -> Parser GeospatialCoordinateBounds
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GeospatialCoordinateBounds"
      ( \Object
x ->
          Double -> Double -> Double -> Double -> GeospatialCoordinateBounds
GeospatialCoordinateBounds'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"North")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"South")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"West")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"East")
      )

instance Prelude.Hashable GeospatialCoordinateBounds where
  hashWithSalt :: Int -> GeospatialCoordinateBounds -> Int
hashWithSalt Int
_salt GeospatialCoordinateBounds' {Double
east :: Double
west :: Double
south :: Double
north :: Double
$sel:east:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:west:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:south:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:north:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
north
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
south
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
west
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
east

instance Prelude.NFData GeospatialCoordinateBounds where
  rnf :: GeospatialCoordinateBounds -> ()
rnf GeospatialCoordinateBounds' {Double
east :: Double
west :: Double
south :: Double
north :: Double
$sel:east:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:west:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:south:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:north:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Double
north
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
south
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
west
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
east

instance Data.ToJSON GeospatialCoordinateBounds where
  toJSON :: GeospatialCoordinateBounds -> Value
toJSON GeospatialCoordinateBounds' {Double
east :: Double
west :: Double
south :: Double
north :: Double
$sel:east:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:west:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:south:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
$sel:north:GeospatialCoordinateBounds' :: GeospatialCoordinateBounds -> Double
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"North" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
north),
            forall a. a -> Maybe a
Prelude.Just (Key
"South" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
south),
            forall a. a -> Maybe a
Prelude.Just (Key
"West" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
west),
            forall a. a -> Maybe a
Prelude.Just (Key
"East" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
east)
          ]
      )