{-# 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.IoTEvents.Types.Input
-- 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.IoTEvents.Types.Input where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEvents.Types.InputConfiguration
import Amazonka.IoTEvents.Types.InputDefinition
import qualified Amazonka.Prelude as Prelude

-- | Information about the input.
--
-- /See:/ 'newInput' smart constructor.
data Input = Input'
  { -- | Information about the configuration of an input.
    Input -> Maybe InputConfiguration
inputConfiguration :: Prelude.Maybe InputConfiguration,
    -- | The definition of the input.
    Input -> Maybe InputDefinition
inputDefinition :: Prelude.Maybe InputDefinition
  }
  deriving (Input -> Input -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Input -> Input -> Bool
$c/= :: Input -> Input -> Bool
== :: Input -> Input -> Bool
$c== :: Input -> Input -> Bool
Prelude.Eq, ReadPrec [Input]
ReadPrec Input
Int -> ReadS Input
ReadS [Input]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Input]
$creadListPrec :: ReadPrec [Input]
readPrec :: ReadPrec Input
$creadPrec :: ReadPrec Input
readList :: ReadS [Input]
$creadList :: ReadS [Input]
readsPrec :: Int -> ReadS Input
$creadsPrec :: Int -> ReadS Input
Prelude.Read, Int -> Input -> ShowS
[Input] -> ShowS
Input -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Input] -> ShowS
$cshowList :: [Input] -> ShowS
show :: Input -> String
$cshow :: Input -> String
showsPrec :: Int -> Input -> ShowS
$cshowsPrec :: Int -> Input -> ShowS
Prelude.Show, forall x. Rep Input x -> Input
forall x. Input -> Rep Input x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Input x -> Input
$cfrom :: forall x. Input -> Rep Input x
Prelude.Generic)

-- |
-- Create a value of 'Input' 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:
--
-- 'inputConfiguration', 'input_inputConfiguration' - Information about the configuration of an input.
--
-- 'inputDefinition', 'input_inputDefinition' - The definition of the input.
newInput ::
  Input
newInput :: Input
newInput =
  Input'
    { $sel:inputConfiguration:Input' :: Maybe InputConfiguration
inputConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:inputDefinition:Input' :: Maybe InputDefinition
inputDefinition = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the configuration of an input.
input_inputConfiguration :: Lens.Lens' Input (Prelude.Maybe InputConfiguration)
input_inputConfiguration :: Lens' Input (Maybe InputConfiguration)
input_inputConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Input' {Maybe InputConfiguration
inputConfiguration :: Maybe InputConfiguration
$sel:inputConfiguration:Input' :: Input -> Maybe InputConfiguration
inputConfiguration} -> Maybe InputConfiguration
inputConfiguration) (\s :: Input
s@Input' {} Maybe InputConfiguration
a -> Input
s {$sel:inputConfiguration:Input' :: Maybe InputConfiguration
inputConfiguration = Maybe InputConfiguration
a} :: Input)

-- | The definition of the input.
input_inputDefinition :: Lens.Lens' Input (Prelude.Maybe InputDefinition)
input_inputDefinition :: Lens' Input (Maybe InputDefinition)
input_inputDefinition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Input' {Maybe InputDefinition
inputDefinition :: Maybe InputDefinition
$sel:inputDefinition:Input' :: Input -> Maybe InputDefinition
inputDefinition} -> Maybe InputDefinition
inputDefinition) (\s :: Input
s@Input' {} Maybe InputDefinition
a -> Input
s {$sel:inputDefinition:Input' :: Maybe InputDefinition
inputDefinition = Maybe InputDefinition
a} :: Input)

instance Data.FromJSON Input where
  parseJSON :: Value -> Parser Input
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Input"
      ( \Object
x ->
          Maybe InputConfiguration -> Maybe InputDefinition -> Input
Input'
            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
"inputConfiguration")
            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
"inputDefinition")
      )

instance Prelude.Hashable Input where
  hashWithSalt :: Int -> Input -> Int
hashWithSalt Int
_salt Input' {Maybe InputDefinition
Maybe InputConfiguration
inputDefinition :: Maybe InputDefinition
inputConfiguration :: Maybe InputConfiguration
$sel:inputDefinition:Input' :: Input -> Maybe InputDefinition
$sel:inputConfiguration:Input' :: Input -> Maybe InputConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputConfiguration
inputConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputDefinition
inputDefinition

instance Prelude.NFData Input where
  rnf :: Input -> ()
rnf Input' {Maybe InputDefinition
Maybe InputConfiguration
inputDefinition :: Maybe InputDefinition
inputConfiguration :: Maybe InputConfiguration
$sel:inputDefinition:Input' :: Input -> Maybe InputDefinition
$sel:inputConfiguration:Input' :: Input -> Maybe InputConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputConfiguration
inputConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputDefinition
inputDefinition