{-# 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.AlexaBusiness.Types.MeetingSetting
-- 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.AlexaBusiness.Types.MeetingSetting where

import Amazonka.AlexaBusiness.Types.RequirePin
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The values that indicate whether a pin is always required (YES), never
-- required (NO), or OPTIONAL.
--
-- -   If YES, Alexa will always ask for a meeting pin.
--
-- -   If NO, Alexa will never ask for a meeting pin.
--
-- -   If OPTIONAL, Alexa will ask if you have a meeting pin and if the
--     customer responds with yes, it will ask for the meeting pin.
--
-- /See:/ 'newMeetingSetting' smart constructor.
data MeetingSetting = MeetingSetting'
  { -- | The values that indicate whether the pin is always required.
    MeetingSetting -> RequirePin
requirePin :: RequirePin
  }
  deriving (MeetingSetting -> MeetingSetting -> Bool
(MeetingSetting -> MeetingSetting -> Bool)
-> (MeetingSetting -> MeetingSetting -> Bool) -> Eq MeetingSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MeetingSetting -> MeetingSetting -> Bool
$c/= :: MeetingSetting -> MeetingSetting -> Bool
== :: MeetingSetting -> MeetingSetting -> Bool
$c== :: MeetingSetting -> MeetingSetting -> Bool
Prelude.Eq, ReadPrec [MeetingSetting]
ReadPrec MeetingSetting
Int -> ReadS MeetingSetting
ReadS [MeetingSetting]
(Int -> ReadS MeetingSetting)
-> ReadS [MeetingSetting]
-> ReadPrec MeetingSetting
-> ReadPrec [MeetingSetting]
-> Read MeetingSetting
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MeetingSetting]
$creadListPrec :: ReadPrec [MeetingSetting]
readPrec :: ReadPrec MeetingSetting
$creadPrec :: ReadPrec MeetingSetting
readList :: ReadS [MeetingSetting]
$creadList :: ReadS [MeetingSetting]
readsPrec :: Int -> ReadS MeetingSetting
$creadsPrec :: Int -> ReadS MeetingSetting
Prelude.Read, Int -> MeetingSetting -> ShowS
[MeetingSetting] -> ShowS
MeetingSetting -> String
(Int -> MeetingSetting -> ShowS)
-> (MeetingSetting -> String)
-> ([MeetingSetting] -> ShowS)
-> Show MeetingSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MeetingSetting] -> ShowS
$cshowList :: [MeetingSetting] -> ShowS
show :: MeetingSetting -> String
$cshow :: MeetingSetting -> String
showsPrec :: Int -> MeetingSetting -> ShowS
$cshowsPrec :: Int -> MeetingSetting -> ShowS
Prelude.Show, (forall x. MeetingSetting -> Rep MeetingSetting x)
-> (forall x. Rep MeetingSetting x -> MeetingSetting)
-> Generic MeetingSetting
forall x. Rep MeetingSetting x -> MeetingSetting
forall x. MeetingSetting -> Rep MeetingSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MeetingSetting x -> MeetingSetting
$cfrom :: forall x. MeetingSetting -> Rep MeetingSetting x
Prelude.Generic)

-- |
-- Create a value of 'MeetingSetting' 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:
--
-- 'requirePin', 'meetingSetting_requirePin' - The values that indicate whether the pin is always required.
newMeetingSetting ::
  -- | 'requirePin'
  RequirePin ->
  MeetingSetting
newMeetingSetting :: RequirePin -> MeetingSetting
newMeetingSetting RequirePin
pRequirePin_ =
  MeetingSetting' :: RequirePin -> MeetingSetting
MeetingSetting' {$sel:requirePin:MeetingSetting' :: RequirePin
requirePin = RequirePin
pRequirePin_}

-- | The values that indicate whether the pin is always required.
meetingSetting_requirePin :: Lens.Lens' MeetingSetting RequirePin
meetingSetting_requirePin :: (RequirePin -> f RequirePin) -> MeetingSetting -> f MeetingSetting
meetingSetting_requirePin = (MeetingSetting -> RequirePin)
-> (MeetingSetting -> RequirePin -> MeetingSetting)
-> Lens MeetingSetting MeetingSetting RequirePin RequirePin
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeetingSetting' {RequirePin
requirePin :: RequirePin
$sel:requirePin:MeetingSetting' :: MeetingSetting -> RequirePin
requirePin} -> RequirePin
requirePin) (\s :: MeetingSetting
s@MeetingSetting' {} RequirePin
a -> MeetingSetting
s {$sel:requirePin:MeetingSetting' :: RequirePin
requirePin = RequirePin
a} :: MeetingSetting)

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

instance Prelude.Hashable MeetingSetting

instance Prelude.NFData MeetingSetting

instance Core.ToJSON MeetingSetting where
  toJSON :: MeetingSetting -> Value
toJSON MeetingSetting' {RequirePin
requirePin :: RequirePin
$sel:requirePin:MeetingSetting' :: MeetingSetting -> RequirePin
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RequirePin" Text -> RequirePin -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RequirePin
requirePin)]
      )