{-# 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.BandMathConfigInput
-- 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.BandMathConfigInput 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.CustomIndicesInput

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

-- |
-- Create a value of 'BandMathConfigInput' 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:
--
-- 'customIndices', 'bandMathConfigInput_customIndices' -
--
-- 'predefinedIndices', 'bandMathConfigInput_predefinedIndices' -
newBandMathConfigInput ::
  BandMathConfigInput
newBandMathConfigInput :: BandMathConfigInput
newBandMathConfigInput =
  BandMathConfigInput'
    { $sel:customIndices:BandMathConfigInput' :: Maybe CustomIndicesInput
customIndices =
        forall a. Maybe a
Prelude.Nothing,
      $sel:predefinedIndices:BandMathConfigInput' :: Maybe (NonEmpty Text)
predefinedIndices = forall a. Maybe a
Prelude.Nothing
    }

bandMathConfigInput_customIndices :: Lens.Lens' BandMathConfigInput (Prelude.Maybe CustomIndicesInput)
bandMathConfigInput_customIndices :: Lens' BandMathConfigInput (Maybe CustomIndicesInput)
bandMathConfigInput_customIndices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandMathConfigInput' {Maybe CustomIndicesInput
customIndices :: Maybe CustomIndicesInput
$sel:customIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe CustomIndicesInput
customIndices} -> Maybe CustomIndicesInput
customIndices) (\s :: BandMathConfigInput
s@BandMathConfigInput' {} Maybe CustomIndicesInput
a -> BandMathConfigInput
s {$sel:customIndices:BandMathConfigInput' :: Maybe CustomIndicesInput
customIndices = Maybe CustomIndicesInput
a} :: BandMathConfigInput)

bandMathConfigInput_predefinedIndices :: Lens.Lens' BandMathConfigInput (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
bandMathConfigInput_predefinedIndices :: Lens' BandMathConfigInput (Maybe (NonEmpty Text))
bandMathConfigInput_predefinedIndices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BandMathConfigInput' {Maybe (NonEmpty Text)
predefinedIndices :: Maybe (NonEmpty Text)
$sel:predefinedIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe (NonEmpty Text)
predefinedIndices} -> Maybe (NonEmpty Text)
predefinedIndices) (\s :: BandMathConfigInput
s@BandMathConfigInput' {} Maybe (NonEmpty Text)
a -> BandMathConfigInput
s {$sel:predefinedIndices:BandMathConfigInput' :: Maybe (NonEmpty Text)
predefinedIndices = Maybe (NonEmpty Text)
a} :: BandMathConfigInput) 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 BandMathConfigInput where
  parseJSON :: Value -> Parser BandMathConfigInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BandMathConfigInput"
      ( \Object
x ->
          Maybe CustomIndicesInput
-> Maybe (NonEmpty Text) -> BandMathConfigInput
BandMathConfigInput'
            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
"CustomIndices")
            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
"PredefinedIndices")
      )

instance Prelude.Hashable BandMathConfigInput where
  hashWithSalt :: Int -> BandMathConfigInput -> Int
hashWithSalt Int
_salt BandMathConfigInput' {Maybe (NonEmpty Text)
Maybe CustomIndicesInput
predefinedIndices :: Maybe (NonEmpty Text)
customIndices :: Maybe CustomIndicesInput
$sel:predefinedIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe (NonEmpty Text)
$sel:customIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe CustomIndicesInput
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomIndicesInput
customIndices
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
predefinedIndices

instance Prelude.NFData BandMathConfigInput where
  rnf :: BandMathConfigInput -> ()
rnf BandMathConfigInput' {Maybe (NonEmpty Text)
Maybe CustomIndicesInput
predefinedIndices :: Maybe (NonEmpty Text)
customIndices :: Maybe CustomIndicesInput
$sel:predefinedIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe (NonEmpty Text)
$sel:customIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe CustomIndicesInput
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomIndicesInput
customIndices
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
predefinedIndices

instance Data.ToJSON BandMathConfigInput where
  toJSON :: BandMathConfigInput -> Value
toJSON BandMathConfigInput' {Maybe (NonEmpty Text)
Maybe CustomIndicesInput
predefinedIndices :: Maybe (NonEmpty Text)
customIndices :: Maybe CustomIndicesInput
$sel:predefinedIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe (NonEmpty Text)
$sel:customIndices:BandMathConfigInput' :: BandMathConfigInput -> Maybe CustomIndicesInput
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CustomIndices" 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 CustomIndicesInput
customIndices,
            (Key
"PredefinedIndices" 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)
predefinedIndices
          ]
      )