{-# 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.LexV2Models.Types.AllowedInputTypes
-- 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.LexV2Models.Types.AllowedInputTypes 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

-- | Specifies the allowed input types.
--
-- /See:/ 'newAllowedInputTypes' smart constructor.
data AllowedInputTypes = AllowedInputTypes'
  { -- | Indicates whether audio input is allowed.
    AllowedInputTypes -> Bool
allowAudioInput :: Prelude.Bool,
    -- | Indicates whether DTMF input is allowed.
    AllowedInputTypes -> Bool
allowDTMFInput :: Prelude.Bool
  }
  deriving (AllowedInputTypes -> AllowedInputTypes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AllowedInputTypes -> AllowedInputTypes -> Bool
$c/= :: AllowedInputTypes -> AllowedInputTypes -> Bool
== :: AllowedInputTypes -> AllowedInputTypes -> Bool
$c== :: AllowedInputTypes -> AllowedInputTypes -> Bool
Prelude.Eq, ReadPrec [AllowedInputTypes]
ReadPrec AllowedInputTypes
Int -> ReadS AllowedInputTypes
ReadS [AllowedInputTypes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AllowedInputTypes]
$creadListPrec :: ReadPrec [AllowedInputTypes]
readPrec :: ReadPrec AllowedInputTypes
$creadPrec :: ReadPrec AllowedInputTypes
readList :: ReadS [AllowedInputTypes]
$creadList :: ReadS [AllowedInputTypes]
readsPrec :: Int -> ReadS AllowedInputTypes
$creadsPrec :: Int -> ReadS AllowedInputTypes
Prelude.Read, Int -> AllowedInputTypes -> ShowS
[AllowedInputTypes] -> ShowS
AllowedInputTypes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AllowedInputTypes] -> ShowS
$cshowList :: [AllowedInputTypes] -> ShowS
show :: AllowedInputTypes -> String
$cshow :: AllowedInputTypes -> String
showsPrec :: Int -> AllowedInputTypes -> ShowS
$cshowsPrec :: Int -> AllowedInputTypes -> ShowS
Prelude.Show, forall x. Rep AllowedInputTypes x -> AllowedInputTypes
forall x. AllowedInputTypes -> Rep AllowedInputTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AllowedInputTypes x -> AllowedInputTypes
$cfrom :: forall x. AllowedInputTypes -> Rep AllowedInputTypes x
Prelude.Generic)

-- |
-- Create a value of 'AllowedInputTypes' 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:
--
-- 'allowAudioInput', 'allowedInputTypes_allowAudioInput' - Indicates whether audio input is allowed.
--
-- 'allowDTMFInput', 'allowedInputTypes_allowDTMFInput' - Indicates whether DTMF input is allowed.
newAllowedInputTypes ::
  -- | 'allowAudioInput'
  Prelude.Bool ->
  -- | 'allowDTMFInput'
  Prelude.Bool ->
  AllowedInputTypes
newAllowedInputTypes :: Bool -> Bool -> AllowedInputTypes
newAllowedInputTypes
  Bool
pAllowAudioInput_
  Bool
pAllowDTMFInput_ =
    AllowedInputTypes'
      { $sel:allowAudioInput:AllowedInputTypes' :: Bool
allowAudioInput =
          Bool
pAllowAudioInput_,
        $sel:allowDTMFInput:AllowedInputTypes' :: Bool
allowDTMFInput = Bool
pAllowDTMFInput_
      }

-- | Indicates whether audio input is allowed.
allowedInputTypes_allowAudioInput :: Lens.Lens' AllowedInputTypes Prelude.Bool
allowedInputTypes_allowAudioInput :: Lens' AllowedInputTypes Bool
allowedInputTypes_allowAudioInput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AllowedInputTypes' {Bool
allowAudioInput :: Bool
$sel:allowAudioInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
allowAudioInput} -> Bool
allowAudioInput) (\s :: AllowedInputTypes
s@AllowedInputTypes' {} Bool
a -> AllowedInputTypes
s {$sel:allowAudioInput:AllowedInputTypes' :: Bool
allowAudioInput = Bool
a} :: AllowedInputTypes)

-- | Indicates whether DTMF input is allowed.
allowedInputTypes_allowDTMFInput :: Lens.Lens' AllowedInputTypes Prelude.Bool
allowedInputTypes_allowDTMFInput :: Lens' AllowedInputTypes Bool
allowedInputTypes_allowDTMFInput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AllowedInputTypes' {Bool
allowDTMFInput :: Bool
$sel:allowDTMFInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
allowDTMFInput} -> Bool
allowDTMFInput) (\s :: AllowedInputTypes
s@AllowedInputTypes' {} Bool
a -> AllowedInputTypes
s {$sel:allowDTMFInput:AllowedInputTypes' :: Bool
allowDTMFInput = Bool
a} :: AllowedInputTypes)

instance Data.FromJSON AllowedInputTypes where
  parseJSON :: Value -> Parser AllowedInputTypes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AllowedInputTypes"
      ( \Object
x ->
          Bool -> Bool -> AllowedInputTypes
AllowedInputTypes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"allowAudioInput")
            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
"allowDTMFInput")
      )

instance Prelude.Hashable AllowedInputTypes where
  hashWithSalt :: Int -> AllowedInputTypes -> Int
hashWithSalt Int
_salt AllowedInputTypes' {Bool
allowDTMFInput :: Bool
allowAudioInput :: Bool
$sel:allowDTMFInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
$sel:allowAudioInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
allowAudioInput
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
allowDTMFInput

instance Prelude.NFData AllowedInputTypes where
  rnf :: AllowedInputTypes -> ()
rnf AllowedInputTypes' {Bool
allowDTMFInput :: Bool
allowAudioInput :: Bool
$sel:allowDTMFInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
$sel:allowAudioInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
allowAudioInput
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
allowDTMFInput

instance Data.ToJSON AllowedInputTypes where
  toJSON :: AllowedInputTypes -> Value
toJSON AllowedInputTypes' {Bool
allowDTMFInput :: Bool
allowAudioInput :: Bool
$sel:allowDTMFInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
$sel:allowAudioInput:AllowedInputTypes' :: AllowedInputTypes -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"allowAudioInput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
allowAudioInput),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"allowDTMFInput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
allowDTMFInput)
          ]
      )