{-# 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.ZonalStatisticsConfigInput
-- 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.ZonalStatisticsConfigInput 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.ZonalStatistics

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

-- |
-- Create a value of 'ZonalStatisticsConfigInput' 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:
--
-- 'targetBands', 'zonalStatisticsConfigInput_targetBands' -
--
-- 'statistics', 'zonalStatisticsConfigInput_statistics' -
--
-- 'zoneS3Path', 'zonalStatisticsConfigInput_zoneS3Path' -
newZonalStatisticsConfigInput ::
  -- | 'statistics'
  Prelude.NonEmpty ZonalStatistics ->
  -- | 'zoneS3Path'
  Prelude.Text ->
  ZonalStatisticsConfigInput
newZonalStatisticsConfigInput :: NonEmpty ZonalStatistics -> Text -> ZonalStatisticsConfigInput
newZonalStatisticsConfigInput
  NonEmpty ZonalStatistics
pStatistics_
  Text
pZoneS3Path_ =
    ZonalStatisticsConfigInput'
      { $sel:targetBands:ZonalStatisticsConfigInput' :: Maybe (NonEmpty Text)
targetBands =
          forall a. Maybe a
Prelude.Nothing,
        $sel:statistics:ZonalStatisticsConfigInput' :: NonEmpty ZonalStatistics
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 ZonalStatistics
pStatistics_,
        $sel:zoneS3Path:ZonalStatisticsConfigInput' :: Text
zoneS3Path = Text
pZoneS3Path_
      }

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

zonalStatisticsConfigInput_statistics :: Lens.Lens' ZonalStatisticsConfigInput (Prelude.NonEmpty ZonalStatistics)
zonalStatisticsConfigInput_statistics :: Lens' ZonalStatisticsConfigInput (NonEmpty ZonalStatistics)
zonalStatisticsConfigInput_statistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalStatisticsConfigInput' {NonEmpty ZonalStatistics
statistics :: NonEmpty ZonalStatistics
$sel:statistics:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> NonEmpty ZonalStatistics
statistics} -> NonEmpty ZonalStatistics
statistics) (\s :: ZonalStatisticsConfigInput
s@ZonalStatisticsConfigInput' {} NonEmpty ZonalStatistics
a -> ZonalStatisticsConfigInput
s {$sel:statistics:ZonalStatisticsConfigInput' :: NonEmpty ZonalStatistics
statistics = NonEmpty ZonalStatistics
a} :: ZonalStatisticsConfigInput) 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

zonalStatisticsConfigInput_zoneS3Path :: Lens.Lens' ZonalStatisticsConfigInput Prelude.Text
zonalStatisticsConfigInput_zoneS3Path :: Lens' ZonalStatisticsConfigInput Text
zonalStatisticsConfigInput_zoneS3Path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalStatisticsConfigInput' {Text
zoneS3Path :: Text
$sel:zoneS3Path:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> Text
zoneS3Path} -> Text
zoneS3Path) (\s :: ZonalStatisticsConfigInput
s@ZonalStatisticsConfigInput' {} Text
a -> ZonalStatisticsConfigInput
s {$sel:zoneS3Path:ZonalStatisticsConfigInput' :: Text
zoneS3Path = Text
a} :: ZonalStatisticsConfigInput)

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

instance Prelude.Hashable ZonalStatisticsConfigInput where
  hashWithSalt :: Int -> ZonalStatisticsConfigInput -> Int
hashWithSalt Int
_salt ZonalStatisticsConfigInput' {Maybe (NonEmpty Text)
NonEmpty ZonalStatistics
Text
zoneS3Path :: Text
statistics :: NonEmpty ZonalStatistics
targetBands :: Maybe (NonEmpty Text)
$sel:zoneS3Path:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> Text
$sel:statistics:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> NonEmpty ZonalStatistics
$sel:targetBands:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
targetBands
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty ZonalStatistics
statistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
zoneS3Path

instance Prelude.NFData ZonalStatisticsConfigInput where
  rnf :: ZonalStatisticsConfigInput -> ()
rnf ZonalStatisticsConfigInput' {Maybe (NonEmpty Text)
NonEmpty ZonalStatistics
Text
zoneS3Path :: Text
statistics :: NonEmpty ZonalStatistics
targetBands :: Maybe (NonEmpty Text)
$sel:zoneS3Path:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> Text
$sel:statistics:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> NonEmpty ZonalStatistics
$sel:targetBands:ZonalStatisticsConfigInput' :: ZonalStatisticsConfigInput -> Maybe (NonEmpty Text)
..} =
    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 ZonalStatistics
statistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
zoneS3Path

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