{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.InputDeviceSettings 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

-- | 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
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]
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
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. 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' {$sel:id:InputDeviceSettings' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing}

-- | The unique ID for the device.
inputDeviceSettings_id :: Lens.Lens' InputDeviceSettings (Prelude.Maybe Prelude.Text)
inputDeviceSettings_id :: Lens' InputDeviceSettings (Maybe Text)
inputDeviceSettings_id = 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 Data.FromJSON InputDeviceSettings where
  parseJSON :: Value -> Parser InputDeviceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputDeviceSettings"
      ( \Object
x ->
          Maybe Text -> InputDeviceSettings
InputDeviceSettings' 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
"id")
      )

instance Prelude.Hashable InputDeviceSettings where
  hashWithSalt :: Int -> InputDeviceSettings -> Int
hashWithSalt Int
_salt InputDeviceSettings' {Maybe Text
id :: Maybe Text
$sel:id:InputDeviceSettings' :: InputDeviceSettings -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData InputDeviceSettings where
  rnf :: InputDeviceSettings -> ()
rnf InputDeviceSettings' {Maybe Text
id :: Maybe Text
$sel:id:InputDeviceSettings' :: InputDeviceSettings -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id

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