{-# 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.MediaLive.Types.InputDeviceSettings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.InputDeviceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Settings for an input device.
--
-- /See:/ 'newInputDeviceSettings' smart constructor.
data InputDeviceSettings = InputDeviceSettings'
  { -- | The unique ID for the device.
    InputDeviceSettings -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (InputDeviceSettings -> InputDeviceSettings -> Bool
(InputDeviceSettings -> InputDeviceSettings -> Bool)
-> (InputDeviceSettings -> InputDeviceSettings -> Bool)
-> Eq InputDeviceSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDeviceSettings -> InputDeviceSettings -> Bool
$c/= :: InputDeviceSettings -> InputDeviceSettings -> Bool
== :: InputDeviceSettings -> InputDeviceSettings -> Bool
$c== :: InputDeviceSettings -> InputDeviceSettings -> Bool
Prelude.Eq, ReadPrec [InputDeviceSettings]
ReadPrec InputDeviceSettings
Int -> ReadS InputDeviceSettings
ReadS [InputDeviceSettings]
(Int -> ReadS InputDeviceSettings)
-> ReadS [InputDeviceSettings]
-> ReadPrec InputDeviceSettings
-> ReadPrec [InputDeviceSettings]
-> Read InputDeviceSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDeviceSettings]
$creadListPrec :: ReadPrec [InputDeviceSettings]
readPrec :: ReadPrec InputDeviceSettings
$creadPrec :: ReadPrec InputDeviceSettings
readList :: ReadS [InputDeviceSettings]
$creadList :: ReadS [InputDeviceSettings]
readsPrec :: Int -> ReadS InputDeviceSettings
$creadsPrec :: Int -> ReadS InputDeviceSettings
Prelude.Read, Int -> InputDeviceSettings -> ShowS
[InputDeviceSettings] -> ShowS
InputDeviceSettings -> String
(Int -> InputDeviceSettings -> ShowS)
-> (InputDeviceSettings -> String)
-> ([InputDeviceSettings] -> ShowS)
-> Show InputDeviceSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDeviceSettings] -> ShowS
$cshowList :: [InputDeviceSettings] -> ShowS
show :: InputDeviceSettings -> String
$cshow :: InputDeviceSettings -> String
showsPrec :: Int -> InputDeviceSettings -> ShowS
$cshowsPrec :: Int -> InputDeviceSettings -> ShowS
Prelude.Show, (forall x. InputDeviceSettings -> Rep InputDeviceSettings x)
-> (forall x. Rep InputDeviceSettings x -> InputDeviceSettings)
-> Generic InputDeviceSettings
forall x. Rep InputDeviceSettings x -> InputDeviceSettings
forall x. InputDeviceSettings -> Rep InputDeviceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputDeviceSettings x -> InputDeviceSettings
$cfrom :: forall x. InputDeviceSettings -> Rep InputDeviceSettings x
Prelude.Generic)

-- |
-- Create a value of 'InputDeviceSettings' 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:
--
-- 'id', 'inputDeviceSettings_id' - The unique ID for the device.
newInputDeviceSettings ::
  InputDeviceSettings
newInputDeviceSettings :: InputDeviceSettings
newInputDeviceSettings =
  InputDeviceSettings' :: Maybe Text -> InputDeviceSettings
InputDeviceSettings' {$sel:id:InputDeviceSettings' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The unique ID for the device.
inputDeviceSettings_id :: Lens.Lens' InputDeviceSettings (Prelude.Maybe Prelude.Text)
inputDeviceSettings_id :: (Maybe Text -> f (Maybe Text))
-> InputDeviceSettings -> f InputDeviceSettings
inputDeviceSettings_id = (InputDeviceSettings -> Maybe Text)
-> (InputDeviceSettings -> Maybe Text -> InputDeviceSettings)
-> Lens
     InputDeviceSettings InputDeviceSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDeviceSettings' {Maybe Text
id :: Maybe Text
$sel:id:InputDeviceSettings' :: InputDeviceSettings -> Maybe Text
id} -> Maybe Text
id) (\s :: InputDeviceSettings
s@InputDeviceSettings' {} Maybe Text
a -> InputDeviceSettings
s {$sel:id:InputDeviceSettings' :: Maybe Text
id = Maybe Text
a} :: InputDeviceSettings)

instance Core.FromJSON InputDeviceSettings where
  parseJSON :: Value -> Parser InputDeviceSettings
parseJSON =
    String
-> (Object -> Parser InputDeviceSettings)
-> Value
-> Parser InputDeviceSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputDeviceSettings"
      ( \Object
x ->
          Maybe Text -> InputDeviceSettings
InputDeviceSettings' (Maybe Text -> InputDeviceSettings)
-> Parser (Maybe Text) -> Parser InputDeviceSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
      )

instance Prelude.Hashable InputDeviceSettings

instance Prelude.NFData InputDeviceSettings

instance Core.ToJSON InputDeviceSettings where
  toJSON :: InputDeviceSettings -> Value
toJSON InputDeviceSettings' {Maybe Text
id :: Maybe Text
$sel:id:InputDeviceSettings' :: InputDeviceSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [(Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id])