{-# 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 #-}
module Amazonka.Chime.Types.UserSettings where
import Amazonka.Chime.Types.TelephonySettings
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UserSettings = UserSettings'
{
UserSettings -> TelephonySettings
telephony :: TelephonySettings
}
deriving (UserSettings -> UserSettings -> Bool
(UserSettings -> UserSettings -> Bool)
-> (UserSettings -> UserSettings -> Bool) -> Eq UserSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserSettings -> UserSettings -> Bool
$c/= :: UserSettings -> UserSettings -> Bool
== :: UserSettings -> UserSettings -> Bool
$c== :: UserSettings -> UserSettings -> Bool
Prelude.Eq, ReadPrec [UserSettings]
ReadPrec UserSettings
Int -> ReadS UserSettings
ReadS [UserSettings]
(Int -> ReadS UserSettings)
-> ReadS [UserSettings]
-> ReadPrec UserSettings
-> ReadPrec [UserSettings]
-> Read UserSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserSettings]
$creadListPrec :: ReadPrec [UserSettings]
readPrec :: ReadPrec UserSettings
$creadPrec :: ReadPrec UserSettings
readList :: ReadS [UserSettings]
$creadList :: ReadS [UserSettings]
readsPrec :: Int -> ReadS UserSettings
$creadsPrec :: Int -> ReadS UserSettings
Prelude.Read, Int -> UserSettings -> ShowS
[UserSettings] -> ShowS
UserSettings -> String
(Int -> UserSettings -> ShowS)
-> (UserSettings -> String)
-> ([UserSettings] -> ShowS)
-> Show UserSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserSettings] -> ShowS
$cshowList :: [UserSettings] -> ShowS
show :: UserSettings -> String
$cshow :: UserSettings -> String
showsPrec :: Int -> UserSettings -> ShowS
$cshowsPrec :: Int -> UserSettings -> ShowS
Prelude.Show, (forall x. UserSettings -> Rep UserSettings x)
-> (forall x. Rep UserSettings x -> UserSettings)
-> Generic UserSettings
forall x. Rep UserSettings x -> UserSettings
forall x. UserSettings -> Rep UserSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserSettings x -> UserSettings
$cfrom :: forall x. UserSettings -> Rep UserSettings x
Prelude.Generic)
newUserSettings ::
TelephonySettings ->
UserSettings
newUserSettings :: TelephonySettings -> UserSettings
newUserSettings TelephonySettings
pTelephony_ =
UserSettings' :: TelephonySettings -> UserSettings
UserSettings' {$sel:telephony:UserSettings' :: TelephonySettings
telephony = TelephonySettings
pTelephony_}
userSettings_telephony :: Lens.Lens' UserSettings TelephonySettings
userSettings_telephony :: (TelephonySettings -> f TelephonySettings)
-> UserSettings -> f UserSettings
userSettings_telephony = (UserSettings -> TelephonySettings)
-> (UserSettings -> TelephonySettings -> UserSettings)
-> Lens
UserSettings UserSettings TelephonySettings TelephonySettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSettings' {TelephonySettings
telephony :: TelephonySettings
$sel:telephony:UserSettings' :: UserSettings -> TelephonySettings
telephony} -> TelephonySettings
telephony) (\s :: UserSettings
s@UserSettings' {} TelephonySettings
a -> UserSettings
s {$sel:telephony:UserSettings' :: TelephonySettings
telephony = TelephonySettings
a} :: UserSettings)
instance Core.FromJSON UserSettings where
parseJSON :: Value -> Parser UserSettings
parseJSON =
String
-> (Object -> Parser UserSettings) -> Value -> Parser UserSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UserSettings"
( \Object
x ->
TelephonySettings -> UserSettings
UserSettings' (TelephonySettings -> UserSettings)
-> Parser TelephonySettings -> Parser UserSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser TelephonySettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Telephony")
)
instance Prelude.Hashable UserSettings
instance Prelude.NFData UserSettings
instance Core.ToJSON UserSettings where
toJSON :: UserSettings -> Value
toJSON UserSettings' {TelephonySettings
telephony :: TelephonySettings
$sel:telephony:UserSettings' :: UserSettings -> TelephonySettings
..} =
[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
"Telephony" Text -> TelephonySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TelephonySettings
telephony)]
)