{-# 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.EmergencyCallingConfiguration where
import Amazonka.Chime.Types.DNISEmergencyCallingConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EmergencyCallingConfiguration = EmergencyCallingConfiguration'
{
EmergencyCallingConfiguration
-> Maybe [DNISEmergencyCallingConfiguration]
dnis :: Prelude.Maybe [DNISEmergencyCallingConfiguration]
}
deriving (EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool
(EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool)
-> (EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool)
-> Eq EmergencyCallingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool
$c/= :: EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool
== :: EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool
$c== :: EmergencyCallingConfiguration
-> EmergencyCallingConfiguration -> Bool
Prelude.Eq, Int -> EmergencyCallingConfiguration -> ShowS
[EmergencyCallingConfiguration] -> ShowS
EmergencyCallingConfiguration -> String
(Int -> EmergencyCallingConfiguration -> ShowS)
-> (EmergencyCallingConfiguration -> String)
-> ([EmergencyCallingConfiguration] -> ShowS)
-> Show EmergencyCallingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmergencyCallingConfiguration] -> ShowS
$cshowList :: [EmergencyCallingConfiguration] -> ShowS
show :: EmergencyCallingConfiguration -> String
$cshow :: EmergencyCallingConfiguration -> String
showsPrec :: Int -> EmergencyCallingConfiguration -> ShowS
$cshowsPrec :: Int -> EmergencyCallingConfiguration -> ShowS
Prelude.Show, (forall x.
EmergencyCallingConfiguration
-> Rep EmergencyCallingConfiguration x)
-> (forall x.
Rep EmergencyCallingConfiguration x
-> EmergencyCallingConfiguration)
-> Generic EmergencyCallingConfiguration
forall x.
Rep EmergencyCallingConfiguration x
-> EmergencyCallingConfiguration
forall x.
EmergencyCallingConfiguration
-> Rep EmergencyCallingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EmergencyCallingConfiguration x
-> EmergencyCallingConfiguration
$cfrom :: forall x.
EmergencyCallingConfiguration
-> Rep EmergencyCallingConfiguration x
Prelude.Generic)
newEmergencyCallingConfiguration ::
EmergencyCallingConfiguration
newEmergencyCallingConfiguration :: EmergencyCallingConfiguration
newEmergencyCallingConfiguration =
EmergencyCallingConfiguration' :: Maybe [DNISEmergencyCallingConfiguration]
-> EmergencyCallingConfiguration
EmergencyCallingConfiguration'
{ $sel:dnis:EmergencyCallingConfiguration' :: Maybe [DNISEmergencyCallingConfiguration]
dnis =
Maybe [DNISEmergencyCallingConfiguration]
forall a. Maybe a
Prelude.Nothing
}
emergencyCallingConfiguration_dnis :: Lens.Lens' EmergencyCallingConfiguration (Prelude.Maybe [DNISEmergencyCallingConfiguration])
emergencyCallingConfiguration_dnis :: (Maybe [DNISEmergencyCallingConfiguration]
-> f (Maybe [DNISEmergencyCallingConfiguration]))
-> EmergencyCallingConfiguration -> f EmergencyCallingConfiguration
emergencyCallingConfiguration_dnis = (EmergencyCallingConfiguration
-> Maybe [DNISEmergencyCallingConfiguration])
-> (EmergencyCallingConfiguration
-> Maybe [DNISEmergencyCallingConfiguration]
-> EmergencyCallingConfiguration)
-> Lens
EmergencyCallingConfiguration
EmergencyCallingConfiguration
(Maybe [DNISEmergencyCallingConfiguration])
(Maybe [DNISEmergencyCallingConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmergencyCallingConfiguration' {Maybe [DNISEmergencyCallingConfiguration]
dnis :: Maybe [DNISEmergencyCallingConfiguration]
$sel:dnis:EmergencyCallingConfiguration' :: EmergencyCallingConfiguration
-> Maybe [DNISEmergencyCallingConfiguration]
dnis} -> Maybe [DNISEmergencyCallingConfiguration]
dnis) (\s :: EmergencyCallingConfiguration
s@EmergencyCallingConfiguration' {} Maybe [DNISEmergencyCallingConfiguration]
a -> EmergencyCallingConfiguration
s {$sel:dnis:EmergencyCallingConfiguration' :: Maybe [DNISEmergencyCallingConfiguration]
dnis = Maybe [DNISEmergencyCallingConfiguration]
a} :: EmergencyCallingConfiguration) ((Maybe [DNISEmergencyCallingConfiguration]
-> f (Maybe [DNISEmergencyCallingConfiguration]))
-> EmergencyCallingConfiguration
-> f EmergencyCallingConfiguration)
-> ((Maybe [DNISEmergencyCallingConfiguration]
-> f (Maybe [DNISEmergencyCallingConfiguration]))
-> Maybe [DNISEmergencyCallingConfiguration]
-> f (Maybe [DNISEmergencyCallingConfiguration]))
-> (Maybe [DNISEmergencyCallingConfiguration]
-> f (Maybe [DNISEmergencyCallingConfiguration]))
-> EmergencyCallingConfiguration
-> f EmergencyCallingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
-> Iso
(Maybe [DNISEmergencyCallingConfiguration])
(Maybe [DNISEmergencyCallingConfiguration])
(Maybe [DNISEmergencyCallingConfiguration])
(Maybe [DNISEmergencyCallingConfiguration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
[DNISEmergencyCallingConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON EmergencyCallingConfiguration where
parseJSON :: Value -> Parser EmergencyCallingConfiguration
parseJSON =
String
-> (Object -> Parser EmergencyCallingConfiguration)
-> Value
-> Parser EmergencyCallingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EmergencyCallingConfiguration"
( \Object
x ->
Maybe [DNISEmergencyCallingConfiguration]
-> EmergencyCallingConfiguration
EmergencyCallingConfiguration'
(Maybe [DNISEmergencyCallingConfiguration]
-> EmergencyCallingConfiguration)
-> Parser (Maybe [DNISEmergencyCallingConfiguration])
-> Parser EmergencyCallingConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe (Maybe [DNISEmergencyCallingConfiguration]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DNIS" Parser (Maybe (Maybe [DNISEmergencyCallingConfiguration]))
-> Maybe [DNISEmergencyCallingConfiguration]
-> Parser (Maybe [DNISEmergencyCallingConfiguration])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DNISEmergencyCallingConfiguration]
forall a. Monoid a => a
Prelude.mempty)
)
instance
Prelude.Hashable
EmergencyCallingConfiguration
instance Prelude.NFData EmergencyCallingConfiguration
instance Core.ToJSON EmergencyCallingConfiguration where
toJSON :: EmergencyCallingConfiguration -> Value
toJSON EmergencyCallingConfiguration' {Maybe [DNISEmergencyCallingConfiguration]
dnis :: Maybe [DNISEmergencyCallingConfiguration]
$sel:dnis:EmergencyCallingConfiguration' :: EmergencyCallingConfiguration
-> Maybe [DNISEmergencyCallingConfiguration]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"DNIS" Text -> [DNISEmergencyCallingConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([DNISEmergencyCallingConfiguration] -> Pair)
-> Maybe [DNISEmergencyCallingConfiguration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DNISEmergencyCallingConfiguration]
dnis]
)