{-# 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.GeoMatchParams where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GeoMatchParams = GeoMatchParams'
{
GeoMatchParams -> Text
country :: Prelude.Text,
GeoMatchParams -> Text
areaCode :: Prelude.Text
}
deriving (GeoMatchParams -> GeoMatchParams -> Bool
(GeoMatchParams -> GeoMatchParams -> Bool)
-> (GeoMatchParams -> GeoMatchParams -> Bool) -> Eq GeoMatchParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoMatchParams -> GeoMatchParams -> Bool
$c/= :: GeoMatchParams -> GeoMatchParams -> Bool
== :: GeoMatchParams -> GeoMatchParams -> Bool
$c== :: GeoMatchParams -> GeoMatchParams -> Bool
Prelude.Eq, ReadPrec [GeoMatchParams]
ReadPrec GeoMatchParams
Int -> ReadS GeoMatchParams
ReadS [GeoMatchParams]
(Int -> ReadS GeoMatchParams)
-> ReadS [GeoMatchParams]
-> ReadPrec GeoMatchParams
-> ReadPrec [GeoMatchParams]
-> Read GeoMatchParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoMatchParams]
$creadListPrec :: ReadPrec [GeoMatchParams]
readPrec :: ReadPrec GeoMatchParams
$creadPrec :: ReadPrec GeoMatchParams
readList :: ReadS [GeoMatchParams]
$creadList :: ReadS [GeoMatchParams]
readsPrec :: Int -> ReadS GeoMatchParams
$creadsPrec :: Int -> ReadS GeoMatchParams
Prelude.Read, Int -> GeoMatchParams -> ShowS
[GeoMatchParams] -> ShowS
GeoMatchParams -> String
(Int -> GeoMatchParams -> ShowS)
-> (GeoMatchParams -> String)
-> ([GeoMatchParams] -> ShowS)
-> Show GeoMatchParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoMatchParams] -> ShowS
$cshowList :: [GeoMatchParams] -> ShowS
show :: GeoMatchParams -> String
$cshow :: GeoMatchParams -> String
showsPrec :: Int -> GeoMatchParams -> ShowS
$cshowsPrec :: Int -> GeoMatchParams -> ShowS
Prelude.Show, (forall x. GeoMatchParams -> Rep GeoMatchParams x)
-> (forall x. Rep GeoMatchParams x -> GeoMatchParams)
-> Generic GeoMatchParams
forall x. Rep GeoMatchParams x -> GeoMatchParams
forall x. GeoMatchParams -> Rep GeoMatchParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoMatchParams x -> GeoMatchParams
$cfrom :: forall x. GeoMatchParams -> Rep GeoMatchParams x
Prelude.Generic)
newGeoMatchParams ::
Prelude.Text ->
Prelude.Text ->
GeoMatchParams
newGeoMatchParams :: Text -> Text -> GeoMatchParams
newGeoMatchParams Text
pCountry_ Text
pAreaCode_ =
GeoMatchParams' :: Text -> Text -> GeoMatchParams
GeoMatchParams'
{ $sel:country:GeoMatchParams' :: Text
country = Text
pCountry_,
$sel:areaCode:GeoMatchParams' :: Text
areaCode = Text
pAreaCode_
}
geoMatchParams_country :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_country :: (Text -> f Text) -> GeoMatchParams -> f GeoMatchParams
geoMatchParams_country = (GeoMatchParams -> Text)
-> (GeoMatchParams -> Text -> GeoMatchParams)
-> Lens GeoMatchParams GeoMatchParams Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchParams' {Text
country :: Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
country} -> Text
country) (\s :: GeoMatchParams
s@GeoMatchParams' {} Text
a -> GeoMatchParams
s {$sel:country:GeoMatchParams' :: Text
country = Text
a} :: GeoMatchParams)
geoMatchParams_areaCode :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_areaCode :: (Text -> f Text) -> GeoMatchParams -> f GeoMatchParams
geoMatchParams_areaCode = (GeoMatchParams -> Text)
-> (GeoMatchParams -> Text -> GeoMatchParams)
-> Lens GeoMatchParams GeoMatchParams Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchParams' {Text
areaCode :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
areaCode} -> Text
areaCode) (\s :: GeoMatchParams
s@GeoMatchParams' {} Text
a -> GeoMatchParams
s {$sel:areaCode:GeoMatchParams' :: Text
areaCode = Text
a} :: GeoMatchParams)
instance Core.FromJSON GeoMatchParams where
parseJSON :: Value -> Parser GeoMatchParams
parseJSON =
String
-> (Object -> Parser GeoMatchParams)
-> Value
-> Parser GeoMatchParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GeoMatchParams"
( \Object
x ->
Text -> Text -> GeoMatchParams
GeoMatchParams'
(Text -> Text -> GeoMatchParams)
-> Parser Text -> Parser (Text -> GeoMatchParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Country")
Parser (Text -> GeoMatchParams)
-> Parser Text -> Parser GeoMatchParams
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AreaCode")
)
instance Prelude.Hashable GeoMatchParams
instance Prelude.NFData GeoMatchParams
instance Core.ToJSON GeoMatchParams where
toJSON :: GeoMatchParams -> Value
toJSON GeoMatchParams' {Text
areaCode :: Text
country :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
..} =
[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
"Country" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
country),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AreaCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
areaCode)
]
)