{-# 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.GeospatialWindowOptions
-- 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.GeospatialWindowOptions 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
import Amazonka.QuickSight.Types.GeospatialCoordinateBounds
import Amazonka.QuickSight.Types.MapZoomMode

-- | The window options of the geospatial map visual.
--
-- /See:/ 'newGeospatialWindowOptions' smart constructor.
data GeospatialWindowOptions = GeospatialWindowOptions'
  { -- | The bounds options (north, south, west, east) of the geospatial window
    -- options.
    GeospatialWindowOptions -> Maybe GeospatialCoordinateBounds
bounds :: Prelude.Maybe GeospatialCoordinateBounds,
    -- | The map zoom modes (manual, auto) of the geospatial window options.
    GeospatialWindowOptions -> Maybe MapZoomMode
mapZoomMode :: Prelude.Maybe MapZoomMode
  }
  deriving (GeospatialWindowOptions -> GeospatialWindowOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeospatialWindowOptions -> GeospatialWindowOptions -> Bool
$c/= :: GeospatialWindowOptions -> GeospatialWindowOptions -> Bool
== :: GeospatialWindowOptions -> GeospatialWindowOptions -> Bool
$c== :: GeospatialWindowOptions -> GeospatialWindowOptions -> Bool
Prelude.Eq, ReadPrec [GeospatialWindowOptions]
ReadPrec GeospatialWindowOptions
Int -> ReadS GeospatialWindowOptions
ReadS [GeospatialWindowOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeospatialWindowOptions]
$creadListPrec :: ReadPrec [GeospatialWindowOptions]
readPrec :: ReadPrec GeospatialWindowOptions
$creadPrec :: ReadPrec GeospatialWindowOptions
readList :: ReadS [GeospatialWindowOptions]
$creadList :: ReadS [GeospatialWindowOptions]
readsPrec :: Int -> ReadS GeospatialWindowOptions
$creadsPrec :: Int -> ReadS GeospatialWindowOptions
Prelude.Read, Int -> GeospatialWindowOptions -> ShowS
[GeospatialWindowOptions] -> ShowS
GeospatialWindowOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeospatialWindowOptions] -> ShowS
$cshowList :: [GeospatialWindowOptions] -> ShowS
show :: GeospatialWindowOptions -> String
$cshow :: GeospatialWindowOptions -> String
showsPrec :: Int -> GeospatialWindowOptions -> ShowS
$cshowsPrec :: Int -> GeospatialWindowOptions -> ShowS
Prelude.Show, forall x. Rep GeospatialWindowOptions x -> GeospatialWindowOptions
forall x. GeospatialWindowOptions -> Rep GeospatialWindowOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeospatialWindowOptions x -> GeospatialWindowOptions
$cfrom :: forall x. GeospatialWindowOptions -> Rep GeospatialWindowOptions x
Prelude.Generic)

-- |
-- Create a value of 'GeospatialWindowOptions' 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:
--
-- 'bounds', 'geospatialWindowOptions_bounds' - The bounds options (north, south, west, east) of the geospatial window
-- options.
--
-- 'mapZoomMode', 'geospatialWindowOptions_mapZoomMode' - The map zoom modes (manual, auto) of the geospatial window options.
newGeospatialWindowOptions ::
  GeospatialWindowOptions
newGeospatialWindowOptions :: GeospatialWindowOptions
newGeospatialWindowOptions =
  GeospatialWindowOptions'
    { $sel:bounds:GeospatialWindowOptions' :: Maybe GeospatialCoordinateBounds
bounds = forall a. Maybe a
Prelude.Nothing,
      $sel:mapZoomMode:GeospatialWindowOptions' :: Maybe MapZoomMode
mapZoomMode = forall a. Maybe a
Prelude.Nothing
    }

-- | The bounds options (north, south, west, east) of the geospatial window
-- options.
geospatialWindowOptions_bounds :: Lens.Lens' GeospatialWindowOptions (Prelude.Maybe GeospatialCoordinateBounds)
geospatialWindowOptions_bounds :: Lens' GeospatialWindowOptions (Maybe GeospatialCoordinateBounds)
geospatialWindowOptions_bounds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialWindowOptions' {Maybe GeospatialCoordinateBounds
bounds :: Maybe GeospatialCoordinateBounds
$sel:bounds:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe GeospatialCoordinateBounds
bounds} -> Maybe GeospatialCoordinateBounds
bounds) (\s :: GeospatialWindowOptions
s@GeospatialWindowOptions' {} Maybe GeospatialCoordinateBounds
a -> GeospatialWindowOptions
s {$sel:bounds:GeospatialWindowOptions' :: Maybe GeospatialCoordinateBounds
bounds = Maybe GeospatialCoordinateBounds
a} :: GeospatialWindowOptions)

-- | The map zoom modes (manual, auto) of the geospatial window options.
geospatialWindowOptions_mapZoomMode :: Lens.Lens' GeospatialWindowOptions (Prelude.Maybe MapZoomMode)
geospatialWindowOptions_mapZoomMode :: Lens' GeospatialWindowOptions (Maybe MapZoomMode)
geospatialWindowOptions_mapZoomMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialWindowOptions' {Maybe MapZoomMode
mapZoomMode :: Maybe MapZoomMode
$sel:mapZoomMode:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe MapZoomMode
mapZoomMode} -> Maybe MapZoomMode
mapZoomMode) (\s :: GeospatialWindowOptions
s@GeospatialWindowOptions' {} Maybe MapZoomMode
a -> GeospatialWindowOptions
s {$sel:mapZoomMode:GeospatialWindowOptions' :: Maybe MapZoomMode
mapZoomMode = Maybe MapZoomMode
a} :: GeospatialWindowOptions)

instance Data.FromJSON GeospatialWindowOptions where
  parseJSON :: Value -> Parser GeospatialWindowOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GeospatialWindowOptions"
      ( \Object
x ->
          Maybe GeospatialCoordinateBounds
-> Maybe MapZoomMode -> GeospatialWindowOptions
GeospatialWindowOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Bounds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MapZoomMode")
      )

instance Prelude.Hashable GeospatialWindowOptions where
  hashWithSalt :: Int -> GeospatialWindowOptions -> Int
hashWithSalt Int
_salt GeospatialWindowOptions' {Maybe GeospatialCoordinateBounds
Maybe MapZoomMode
mapZoomMode :: Maybe MapZoomMode
bounds :: Maybe GeospatialCoordinateBounds
$sel:mapZoomMode:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe MapZoomMode
$sel:bounds:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe GeospatialCoordinateBounds
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GeospatialCoordinateBounds
bounds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MapZoomMode
mapZoomMode

instance Prelude.NFData GeospatialWindowOptions where
  rnf :: GeospatialWindowOptions -> ()
rnf GeospatialWindowOptions' {Maybe GeospatialCoordinateBounds
Maybe MapZoomMode
mapZoomMode :: Maybe MapZoomMode
bounds :: Maybe GeospatialCoordinateBounds
$sel:mapZoomMode:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe MapZoomMode
$sel:bounds:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe GeospatialCoordinateBounds
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GeospatialCoordinateBounds
bounds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MapZoomMode
mapZoomMode

instance Data.ToJSON GeospatialWindowOptions where
  toJSON :: GeospatialWindowOptions -> Value
toJSON GeospatialWindowOptions' {Maybe GeospatialCoordinateBounds
Maybe MapZoomMode
mapZoomMode :: Maybe MapZoomMode
bounds :: Maybe GeospatialCoordinateBounds
$sel:mapZoomMode:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe MapZoomMode
$sel:bounds:GeospatialWindowOptions' :: GeospatialWindowOptions -> Maybe GeospatialCoordinateBounds
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Bounds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GeospatialCoordinateBounds
bounds,
            (Key
"MapZoomMode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MapZoomMode
mapZoomMode
          ]
      )