{-# 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.SageMakerGeoSpatial.Types.TemporalStatisticsConfigInput
-- 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.SageMakerGeoSpatial.Types.TemporalStatisticsConfigInput 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.SageMakerGeoSpatial.Types.GroupBy
import Amazonka.SageMakerGeoSpatial.Types.TemporalStatistics

-- |
--
-- /See:/ 'newTemporalStatisticsConfigInput' smart constructor.
data TemporalStatisticsConfigInput = TemporalStatisticsConfigInput'
  { TemporalStatisticsConfigInput -> Maybe GroupBy
groupBy :: Prelude.Maybe GroupBy,
    TemporalStatisticsConfigInput -> Maybe (NonEmpty Text)
targetBands :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    TemporalStatisticsConfigInput -> NonEmpty TemporalStatistics
statistics :: Prelude.NonEmpty TemporalStatistics
  }
  deriving (TemporalStatisticsConfigInput
-> TemporalStatisticsConfigInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemporalStatisticsConfigInput
-> TemporalStatisticsConfigInput -> Bool
$c/= :: TemporalStatisticsConfigInput
-> TemporalStatisticsConfigInput -> Bool
== :: TemporalStatisticsConfigInput
-> TemporalStatisticsConfigInput -> Bool
$c== :: TemporalStatisticsConfigInput
-> TemporalStatisticsConfigInput -> Bool
Prelude.Eq, ReadPrec [TemporalStatisticsConfigInput]
ReadPrec TemporalStatisticsConfigInput
Int -> ReadS TemporalStatisticsConfigInput
ReadS [TemporalStatisticsConfigInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemporalStatisticsConfigInput]
$creadListPrec :: ReadPrec [TemporalStatisticsConfigInput]
readPrec :: ReadPrec TemporalStatisticsConfigInput
$creadPrec :: ReadPrec TemporalStatisticsConfigInput
readList :: ReadS [TemporalStatisticsConfigInput]
$creadList :: ReadS [TemporalStatisticsConfigInput]
readsPrec :: Int -> ReadS TemporalStatisticsConfigInput
$creadsPrec :: Int -> ReadS TemporalStatisticsConfigInput
Prelude.Read, Int -> TemporalStatisticsConfigInput -> ShowS
[TemporalStatisticsConfigInput] -> ShowS
TemporalStatisticsConfigInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemporalStatisticsConfigInput] -> ShowS
$cshowList :: [TemporalStatisticsConfigInput] -> ShowS
show :: TemporalStatisticsConfigInput -> String
$cshow :: TemporalStatisticsConfigInput -> String
showsPrec :: Int -> TemporalStatisticsConfigInput -> ShowS
$cshowsPrec :: Int -> TemporalStatisticsConfigInput -> ShowS
Prelude.Show, forall x.
Rep TemporalStatisticsConfigInput x
-> TemporalStatisticsConfigInput
forall x.
TemporalStatisticsConfigInput
-> Rep TemporalStatisticsConfigInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TemporalStatisticsConfigInput x
-> TemporalStatisticsConfigInput
$cfrom :: forall x.
TemporalStatisticsConfigInput
-> Rep TemporalStatisticsConfigInput x
Prelude.Generic)

-- |
-- Create a value of 'TemporalStatisticsConfigInput' 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:
--
-- 'groupBy', 'temporalStatisticsConfigInput_groupBy' -
--
-- 'targetBands', 'temporalStatisticsConfigInput_targetBands' -
--
-- 'statistics', 'temporalStatisticsConfigInput_statistics' -
newTemporalStatisticsConfigInput ::
  -- | 'statistics'
  Prelude.NonEmpty TemporalStatistics ->
  TemporalStatisticsConfigInput
newTemporalStatisticsConfigInput :: NonEmpty TemporalStatistics -> TemporalStatisticsConfigInput
newTemporalStatisticsConfigInput NonEmpty TemporalStatistics
pStatistics_ =
  TemporalStatisticsConfigInput'
    { $sel:groupBy:TemporalStatisticsConfigInput' :: Maybe GroupBy
groupBy =
        forall a. Maybe a
Prelude.Nothing,
      $sel:targetBands:TemporalStatisticsConfigInput' :: Maybe (NonEmpty Text)
targetBands = forall a. Maybe a
Prelude.Nothing,
      $sel:statistics:TemporalStatisticsConfigInput' :: NonEmpty TemporalStatistics
statistics =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty TemporalStatistics
pStatistics_
    }

temporalStatisticsConfigInput_groupBy :: Lens.Lens' TemporalStatisticsConfigInput (Prelude.Maybe GroupBy)
temporalStatisticsConfigInput_groupBy :: Lens' TemporalStatisticsConfigInput (Maybe GroupBy)
temporalStatisticsConfigInput_groupBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemporalStatisticsConfigInput' {Maybe GroupBy
groupBy :: Maybe GroupBy
$sel:groupBy:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe GroupBy
groupBy} -> Maybe GroupBy
groupBy) (\s :: TemporalStatisticsConfigInput
s@TemporalStatisticsConfigInput' {} Maybe GroupBy
a -> TemporalStatisticsConfigInput
s {$sel:groupBy:TemporalStatisticsConfigInput' :: Maybe GroupBy
groupBy = Maybe GroupBy
a} :: TemporalStatisticsConfigInput)

temporalStatisticsConfigInput_targetBands :: Lens.Lens' TemporalStatisticsConfigInput (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
temporalStatisticsConfigInput_targetBands :: Lens' TemporalStatisticsConfigInput (Maybe (NonEmpty Text))
temporalStatisticsConfigInput_targetBands = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemporalStatisticsConfigInput' {Maybe (NonEmpty Text)
targetBands :: Maybe (NonEmpty Text)
$sel:targetBands:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe (NonEmpty Text)
targetBands} -> Maybe (NonEmpty Text)
targetBands) (\s :: TemporalStatisticsConfigInput
s@TemporalStatisticsConfigInput' {} Maybe (NonEmpty Text)
a -> TemporalStatisticsConfigInput
s {$sel:targetBands:TemporalStatisticsConfigInput' :: Maybe (NonEmpty Text)
targetBands = Maybe (NonEmpty Text)
a} :: TemporalStatisticsConfigInput) 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

temporalStatisticsConfigInput_statistics :: Lens.Lens' TemporalStatisticsConfigInput (Prelude.NonEmpty TemporalStatistics)
temporalStatisticsConfigInput_statistics :: Lens' TemporalStatisticsConfigInput (NonEmpty TemporalStatistics)
temporalStatisticsConfigInput_statistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemporalStatisticsConfigInput' {NonEmpty TemporalStatistics
statistics :: NonEmpty TemporalStatistics
$sel:statistics:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> NonEmpty TemporalStatistics
statistics} -> NonEmpty TemporalStatistics
statistics) (\s :: TemporalStatisticsConfigInput
s@TemporalStatisticsConfigInput' {} NonEmpty TemporalStatistics
a -> TemporalStatisticsConfigInput
s {$sel:statistics:TemporalStatisticsConfigInput' :: NonEmpty TemporalStatistics
statistics = NonEmpty TemporalStatistics
a} :: TemporalStatisticsConfigInput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON TemporalStatisticsConfigInput where
  parseJSON :: Value -> Parser TemporalStatisticsConfigInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemporalStatisticsConfigInput"
      ( \Object
x ->
          Maybe GroupBy
-> Maybe (NonEmpty Text)
-> NonEmpty TemporalStatistics
-> TemporalStatisticsConfigInput
TemporalStatisticsConfigInput'
            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
"GroupBy")
            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
"TargetBands")
            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
"Statistics")
      )

instance
  Prelude.Hashable
    TemporalStatisticsConfigInput
  where
  hashWithSalt :: Int -> TemporalStatisticsConfigInput -> Int
hashWithSalt Int
_salt TemporalStatisticsConfigInput' {Maybe (NonEmpty Text)
Maybe GroupBy
NonEmpty TemporalStatistics
statistics :: NonEmpty TemporalStatistics
targetBands :: Maybe (NonEmpty Text)
groupBy :: Maybe GroupBy
$sel:statistics:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> NonEmpty TemporalStatistics
$sel:targetBands:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe (NonEmpty Text)
$sel:groupBy:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe GroupBy
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GroupBy
groupBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
targetBands
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty TemporalStatistics
statistics

instance Prelude.NFData TemporalStatisticsConfigInput where
  rnf :: TemporalStatisticsConfigInput -> ()
rnf TemporalStatisticsConfigInput' {Maybe (NonEmpty Text)
Maybe GroupBy
NonEmpty TemporalStatistics
statistics :: NonEmpty TemporalStatistics
targetBands :: Maybe (NonEmpty Text)
groupBy :: Maybe GroupBy
$sel:statistics:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> NonEmpty TemporalStatistics
$sel:targetBands:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe (NonEmpty Text)
$sel:groupBy:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe GroupBy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GroupBy
groupBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
targetBands
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty TemporalStatistics
statistics

instance Data.ToJSON TemporalStatisticsConfigInput where
  toJSON :: TemporalStatisticsConfigInput -> Value
toJSON TemporalStatisticsConfigInput' {Maybe (NonEmpty Text)
Maybe GroupBy
NonEmpty TemporalStatistics
statistics :: NonEmpty TemporalStatistics
targetBands :: Maybe (NonEmpty Text)
groupBy :: Maybe GroupBy
$sel:statistics:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> NonEmpty TemporalStatistics
$sel:targetBands:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe (NonEmpty Text)
$sel:groupBy:TemporalStatisticsConfigInput' :: TemporalStatisticsConfigInput -> Maybe GroupBy
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"GroupBy" 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 GroupBy
groupBy,
            (Key
"TargetBands" 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 (NonEmpty Text)
targetBands,
            forall a. a -> Maybe a
Prelude.Just (Key
"Statistics" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty TemporalStatistics
statistics)
          ]
      )