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

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

-- |
-- Create a value of 'CustomIndicesInput' 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:
--
-- 'operations', 'customIndicesInput_operations' -
newCustomIndicesInput ::
  CustomIndicesInput
newCustomIndicesInput :: CustomIndicesInput
newCustomIndicesInput =
  CustomIndicesInput' {$sel:operations:CustomIndicesInput' :: Maybe (NonEmpty Operation)
operations = forall a. Maybe a
Prelude.Nothing}

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

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

instance Prelude.NFData CustomIndicesInput where
  rnf :: CustomIndicesInput -> ()
rnf CustomIndicesInput' {Maybe (NonEmpty Operation)
operations :: Maybe (NonEmpty Operation)
$sel:operations:CustomIndicesInput' :: CustomIndicesInput -> Maybe (NonEmpty Operation)
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Operation)
operations

instance Data.ToJSON CustomIndicesInput where
  toJSON :: CustomIndicesInput -> Value
toJSON CustomIndicesInput' {Maybe (NonEmpty Operation)
operations :: Maybe (NonEmpty Operation)
$sel:operations:CustomIndicesInput' :: CustomIndicesInput -> Maybe (NonEmpty Operation)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Operations" 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 Operation)
operations]
      )