{-# 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.PlatformInput
-- 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.PlatformInput 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.ComparisonOperator

-- |
--
-- /See:/ 'newPlatformInput' smart constructor.
data PlatformInput = PlatformInput'
  { PlatformInput -> Maybe ComparisonOperator
comparisonOperator :: Prelude.Maybe ComparisonOperator,
    -- | The value of the platform.
    PlatformInput -> Text
value :: Prelude.Text
  }
  deriving (PlatformInput -> PlatformInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlatformInput -> PlatformInput -> Bool
$c/= :: PlatformInput -> PlatformInput -> Bool
== :: PlatformInput -> PlatformInput -> Bool
$c== :: PlatformInput -> PlatformInput -> Bool
Prelude.Eq, ReadPrec [PlatformInput]
ReadPrec PlatformInput
Int -> ReadS PlatformInput
ReadS [PlatformInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlatformInput]
$creadListPrec :: ReadPrec [PlatformInput]
readPrec :: ReadPrec PlatformInput
$creadPrec :: ReadPrec PlatformInput
readList :: ReadS [PlatformInput]
$creadList :: ReadS [PlatformInput]
readsPrec :: Int -> ReadS PlatformInput
$creadsPrec :: Int -> ReadS PlatformInput
Prelude.Read, Int -> PlatformInput -> ShowS
[PlatformInput] -> ShowS
PlatformInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlatformInput] -> ShowS
$cshowList :: [PlatformInput] -> ShowS
show :: PlatformInput -> String
$cshow :: PlatformInput -> String
showsPrec :: Int -> PlatformInput -> ShowS
$cshowsPrec :: Int -> PlatformInput -> ShowS
Prelude.Show, forall x. Rep PlatformInput x -> PlatformInput
forall x. PlatformInput -> Rep PlatformInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlatformInput x -> PlatformInput
$cfrom :: forall x. PlatformInput -> Rep PlatformInput x
Prelude.Generic)

-- |
-- Create a value of 'PlatformInput' 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:
--
-- 'comparisonOperator', 'platformInput_comparisonOperator' -
--
-- 'value', 'platformInput_value' - The value of the platform.
newPlatformInput ::
  -- | 'value'
  Prelude.Text ->
  PlatformInput
newPlatformInput :: Text -> PlatformInput
newPlatformInput Text
pValue_ =
  PlatformInput'
    { $sel:comparisonOperator:PlatformInput' :: Maybe ComparisonOperator
comparisonOperator =
        forall a. Maybe a
Prelude.Nothing,
      $sel:value:PlatformInput' :: Text
value = Text
pValue_
    }

platformInput_comparisonOperator :: Lens.Lens' PlatformInput (Prelude.Maybe ComparisonOperator)
platformInput_comparisonOperator :: Lens' PlatformInput (Maybe ComparisonOperator)
platformInput_comparisonOperator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformInput' {Maybe ComparisonOperator
comparisonOperator :: Maybe ComparisonOperator
$sel:comparisonOperator:PlatformInput' :: PlatformInput -> Maybe ComparisonOperator
comparisonOperator} -> Maybe ComparisonOperator
comparisonOperator) (\s :: PlatformInput
s@PlatformInput' {} Maybe ComparisonOperator
a -> PlatformInput
s {$sel:comparisonOperator:PlatformInput' :: Maybe ComparisonOperator
comparisonOperator = Maybe ComparisonOperator
a} :: PlatformInput)

-- | The value of the platform.
platformInput_value :: Lens.Lens' PlatformInput Prelude.Text
platformInput_value :: Lens' PlatformInput Text
platformInput_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformInput' {Text
value :: Text
$sel:value:PlatformInput' :: PlatformInput -> Text
value} -> Text
value) (\s :: PlatformInput
s@PlatformInput' {} Text
a -> PlatformInput
s {$sel:value:PlatformInput' :: Text
value = Text
a} :: PlatformInput)

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

instance Prelude.Hashable PlatformInput where
  hashWithSalt :: Int -> PlatformInput -> Int
hashWithSalt Int
_salt PlatformInput' {Maybe ComparisonOperator
Text
value :: Text
comparisonOperator :: Maybe ComparisonOperator
$sel:value:PlatformInput' :: PlatformInput -> Text
$sel:comparisonOperator:PlatformInput' :: PlatformInput -> Maybe ComparisonOperator
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComparisonOperator
comparisonOperator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData PlatformInput where
  rnf :: PlatformInput -> ()
rnf PlatformInput' {Maybe ComparisonOperator
Text
value :: Text
comparisonOperator :: Maybe ComparisonOperator
$sel:value:PlatformInput' :: PlatformInput -> Text
$sel:comparisonOperator:PlatformInput' :: PlatformInput -> Maybe ComparisonOperator
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ComparisonOperator
comparisonOperator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value

instance Data.ToJSON PlatformInput where
  toJSON :: PlatformInput -> Value
toJSON PlatformInput' {Maybe ComparisonOperator
Text
value :: Text
comparisonOperator :: Maybe ComparisonOperator
$sel:value:PlatformInput' :: PlatformInput -> Text
$sel:comparisonOperator:PlatformInput' :: PlatformInput -> Maybe ComparisonOperator
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ComparisonOperator" 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 ComparisonOperator
comparisonOperator,
            forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
          ]
      )