{-# 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.GeospatialMapAggregatedFieldWells
-- 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.GeospatialMapAggregatedFieldWells 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.DimensionField
import Amazonka.QuickSight.Types.MeasureField

-- | The aggregated field wells for a geospatial map.
--
-- /See:/ 'newGeospatialMapAggregatedFieldWells' smart constructor.
data GeospatialMapAggregatedFieldWells = GeospatialMapAggregatedFieldWells'
  { -- | The color field wells of a geospatial map.
    GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
colors :: Prelude.Maybe [DimensionField],
    -- | The geospatial field wells of a geospatial map. Values are grouped by
    -- geospatial fields.
    GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
geospatial :: Prelude.Maybe [DimensionField],
    -- | The size field wells of a geospatial map. Values are aggregated based on
    -- geospatial fields.
    GeospatialMapAggregatedFieldWells -> Maybe [MeasureField]
values :: Prelude.Maybe [MeasureField]
  }
  deriving (GeospatialMapAggregatedFieldWells
-> GeospatialMapAggregatedFieldWells -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeospatialMapAggregatedFieldWells
-> GeospatialMapAggregatedFieldWells -> Bool
$c/= :: GeospatialMapAggregatedFieldWells
-> GeospatialMapAggregatedFieldWells -> Bool
== :: GeospatialMapAggregatedFieldWells
-> GeospatialMapAggregatedFieldWells -> Bool
$c== :: GeospatialMapAggregatedFieldWells
-> GeospatialMapAggregatedFieldWells -> Bool
Prelude.Eq, Int -> GeospatialMapAggregatedFieldWells -> ShowS
[GeospatialMapAggregatedFieldWells] -> ShowS
GeospatialMapAggregatedFieldWells -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeospatialMapAggregatedFieldWells] -> ShowS
$cshowList :: [GeospatialMapAggregatedFieldWells] -> ShowS
show :: GeospatialMapAggregatedFieldWells -> String
$cshow :: GeospatialMapAggregatedFieldWells -> String
showsPrec :: Int -> GeospatialMapAggregatedFieldWells -> ShowS
$cshowsPrec :: Int -> GeospatialMapAggregatedFieldWells -> ShowS
Prelude.Show, forall x.
Rep GeospatialMapAggregatedFieldWells x
-> GeospatialMapAggregatedFieldWells
forall x.
GeospatialMapAggregatedFieldWells
-> Rep GeospatialMapAggregatedFieldWells x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GeospatialMapAggregatedFieldWells x
-> GeospatialMapAggregatedFieldWells
$cfrom :: forall x.
GeospatialMapAggregatedFieldWells
-> Rep GeospatialMapAggregatedFieldWells x
Prelude.Generic)

-- |
-- Create a value of 'GeospatialMapAggregatedFieldWells' 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:
--
-- 'colors', 'geospatialMapAggregatedFieldWells_colors' - The color field wells of a geospatial map.
--
-- 'geospatial', 'geospatialMapAggregatedFieldWells_geospatial' - The geospatial field wells of a geospatial map. Values are grouped by
-- geospatial fields.
--
-- 'values', 'geospatialMapAggregatedFieldWells_values' - The size field wells of a geospatial map. Values are aggregated based on
-- geospatial fields.
newGeospatialMapAggregatedFieldWells ::
  GeospatialMapAggregatedFieldWells
newGeospatialMapAggregatedFieldWells :: GeospatialMapAggregatedFieldWells
newGeospatialMapAggregatedFieldWells =
  GeospatialMapAggregatedFieldWells'
    { $sel:colors:GeospatialMapAggregatedFieldWells' :: Maybe [DimensionField]
colors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:geospatial:GeospatialMapAggregatedFieldWells' :: Maybe [DimensionField]
geospatial = forall a. Maybe a
Prelude.Nothing,
      $sel:values:GeospatialMapAggregatedFieldWells' :: Maybe [MeasureField]
values = forall a. Maybe a
Prelude.Nothing
    }

-- | The color field wells of a geospatial map.
geospatialMapAggregatedFieldWells_colors :: Lens.Lens' GeospatialMapAggregatedFieldWells (Prelude.Maybe [DimensionField])
geospatialMapAggregatedFieldWells_colors :: Lens' GeospatialMapAggregatedFieldWells (Maybe [DimensionField])
geospatialMapAggregatedFieldWells_colors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialMapAggregatedFieldWells' {Maybe [DimensionField]
colors :: Maybe [DimensionField]
$sel:colors:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
colors} -> Maybe [DimensionField]
colors) (\s :: GeospatialMapAggregatedFieldWells
s@GeospatialMapAggregatedFieldWells' {} Maybe [DimensionField]
a -> GeospatialMapAggregatedFieldWells
s {$sel:colors:GeospatialMapAggregatedFieldWells' :: Maybe [DimensionField]
colors = Maybe [DimensionField]
a} :: GeospatialMapAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The geospatial field wells of a geospatial map. Values are grouped by
-- geospatial fields.
geospatialMapAggregatedFieldWells_geospatial :: Lens.Lens' GeospatialMapAggregatedFieldWells (Prelude.Maybe [DimensionField])
geospatialMapAggregatedFieldWells_geospatial :: Lens' GeospatialMapAggregatedFieldWells (Maybe [DimensionField])
geospatialMapAggregatedFieldWells_geospatial = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialMapAggregatedFieldWells' {Maybe [DimensionField]
geospatial :: Maybe [DimensionField]
$sel:geospatial:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
geospatial} -> Maybe [DimensionField]
geospatial) (\s :: GeospatialMapAggregatedFieldWells
s@GeospatialMapAggregatedFieldWells' {} Maybe [DimensionField]
a -> GeospatialMapAggregatedFieldWells
s {$sel:geospatial:GeospatialMapAggregatedFieldWells' :: Maybe [DimensionField]
geospatial = Maybe [DimensionField]
a} :: GeospatialMapAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The size field wells of a geospatial map. Values are aggregated based on
-- geospatial fields.
geospatialMapAggregatedFieldWells_values :: Lens.Lens' GeospatialMapAggregatedFieldWells (Prelude.Maybe [MeasureField])
geospatialMapAggregatedFieldWells_values :: Lens' GeospatialMapAggregatedFieldWells (Maybe [MeasureField])
geospatialMapAggregatedFieldWells_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeospatialMapAggregatedFieldWells' {Maybe [MeasureField]
values :: Maybe [MeasureField]
$sel:values:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [MeasureField]
values} -> Maybe [MeasureField]
values) (\s :: GeospatialMapAggregatedFieldWells
s@GeospatialMapAggregatedFieldWells' {} Maybe [MeasureField]
a -> GeospatialMapAggregatedFieldWells
s {$sel:values:GeospatialMapAggregatedFieldWells' :: Maybe [MeasureField]
values = Maybe [MeasureField]
a} :: GeospatialMapAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    GeospatialMapAggregatedFieldWells
  where
  parseJSON :: Value -> Parser GeospatialMapAggregatedFieldWells
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GeospatialMapAggregatedFieldWells"
      ( \Object
x ->
          Maybe [DimensionField]
-> Maybe [DimensionField]
-> Maybe [MeasureField]
-> GeospatialMapAggregatedFieldWells
GeospatialMapAggregatedFieldWells'
            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
"Colors" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Geospatial" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Values" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    GeospatialMapAggregatedFieldWells
  where
  hashWithSalt :: Int -> GeospatialMapAggregatedFieldWells -> Int
hashWithSalt
    Int
_salt
    GeospatialMapAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
values :: Maybe [MeasureField]
geospatial :: Maybe [DimensionField]
colors :: Maybe [DimensionField]
$sel:values:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [MeasureField]
$sel:geospatial:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
$sel:colors:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DimensionField]
colors
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DimensionField]
geospatial
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MeasureField]
values

instance
  Prelude.NFData
    GeospatialMapAggregatedFieldWells
  where
  rnf :: GeospatialMapAggregatedFieldWells -> ()
rnf GeospatialMapAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
values :: Maybe [MeasureField]
geospatial :: Maybe [DimensionField]
colors :: Maybe [DimensionField]
$sel:values:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [MeasureField]
$sel:geospatial:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
$sel:colors:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DimensionField]
colors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DimensionField]
geospatial
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MeasureField]
values

instance
  Data.ToJSON
    GeospatialMapAggregatedFieldWells
  where
  toJSON :: GeospatialMapAggregatedFieldWells -> Value
toJSON GeospatialMapAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
values :: Maybe [MeasureField]
geospatial :: Maybe [DimensionField]
colors :: Maybe [DimensionField]
$sel:values:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [MeasureField]
$sel:geospatial:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
$sel:colors:GeospatialMapAggregatedFieldWells' :: GeospatialMapAggregatedFieldWells -> Maybe [DimensionField]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Colors" 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 [DimensionField]
colors,
            (Key
"Geospatial" 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 [DimensionField]
geospatial,
            (Key
"Values" 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 [MeasureField]
values
          ]
      )