{-# 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.CustomerProfiles.Types.Address where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Address = Address'
{
Address -> Maybe Text
address2 :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
address4 :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
county :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
address3 :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
postalCode :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
country :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
city :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
address1 :: Prelude.Maybe Prelude.Text,
Address -> Maybe Text
province :: Prelude.Maybe Prelude.Text
}
deriving (Address -> Address -> Bool
(Address -> Address -> Bool)
-> (Address -> Address -> Bool) -> Eq Address
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Address -> Address -> Bool
$c/= :: Address -> Address -> Bool
== :: Address -> Address -> Bool
$c== :: Address -> Address -> Bool
Prelude.Eq, ReadPrec [Address]
ReadPrec Address
Int -> ReadS Address
ReadS [Address]
(Int -> ReadS Address)
-> ReadS [Address]
-> ReadPrec Address
-> ReadPrec [Address]
-> Read Address
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Address]
$creadListPrec :: ReadPrec [Address]
readPrec :: ReadPrec Address
$creadPrec :: ReadPrec Address
readList :: ReadS [Address]
$creadList :: ReadS [Address]
readsPrec :: Int -> ReadS Address
$creadsPrec :: Int -> ReadS Address
Prelude.Read, Int -> Address -> ShowS
[Address] -> ShowS
Address -> String
(Int -> Address -> ShowS)
-> (Address -> String) -> ([Address] -> ShowS) -> Show Address
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Address] -> ShowS
$cshowList :: [Address] -> ShowS
show :: Address -> String
$cshow :: Address -> String
showsPrec :: Int -> Address -> ShowS
$cshowsPrec :: Int -> Address -> ShowS
Prelude.Show, (forall x. Address -> Rep Address x)
-> (forall x. Rep Address x -> Address) -> Generic Address
forall x. Rep Address x -> Address
forall x. Address -> Rep Address x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Address x -> Address
$cfrom :: forall x. Address -> Rep Address x
Prelude.Generic)
newAddress ::
Address
newAddress :: Address
newAddress =
Address' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address
Address'
{ $sel:address2:Address' :: Maybe Text
address2 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:Address' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:address4:Address' :: Maybe Text
address4 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:county:Address' :: Maybe Text
county = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:address3:Address' :: Maybe Text
address3 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:postalCode:Address' :: Maybe Text
postalCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:country:Address' :: Maybe Text
country = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:city:Address' :: Maybe Text
city = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:address1:Address' :: Maybe Text
address1 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:province:Address' :: Maybe Text
province = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
address_address2 :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_address2 :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_address2 = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
address2 :: Maybe Text
$sel:address2:Address' :: Address -> Maybe Text
address2} -> Maybe Text
address2) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:address2:Address' :: Maybe Text
address2 = Maybe Text
a} :: Address)
address_state :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_state :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_state = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
state :: Maybe Text
$sel:state:Address' :: Address -> Maybe Text
state} -> Maybe Text
state) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:state:Address' :: Maybe Text
state = Maybe Text
a} :: Address)
address_address4 :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_address4 :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_address4 = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
address4 :: Maybe Text
$sel:address4:Address' :: Address -> Maybe Text
address4} -> Maybe Text
address4) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:address4:Address' :: Maybe Text
address4 = Maybe Text
a} :: Address)
address_county :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_county :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_county = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
county :: Maybe Text
$sel:county:Address' :: Address -> Maybe Text
county} -> Maybe Text
county) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:county:Address' :: Maybe Text
county = Maybe Text
a} :: Address)
address_address3 :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_address3 :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_address3 = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
address3 :: Maybe Text
$sel:address3:Address' :: Address -> Maybe Text
address3} -> Maybe Text
address3) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:address3:Address' :: Maybe Text
address3 = Maybe Text
a} :: Address)
address_postalCode :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_postalCode :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_postalCode = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
postalCode :: Maybe Text
$sel:postalCode:Address' :: Address -> Maybe Text
postalCode} -> Maybe Text
postalCode) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:postalCode:Address' :: Maybe Text
postalCode = Maybe Text
a} :: Address)
address_country :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_country :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_country = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
country :: Maybe Text
$sel:country:Address' :: Address -> Maybe Text
country} -> Maybe Text
country) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:country:Address' :: Maybe Text
country = Maybe Text
a} :: Address)
address_city :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_city :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_city = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
city :: Maybe Text
$sel:city:Address' :: Address -> Maybe Text
city} -> Maybe Text
city) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:city:Address' :: Maybe Text
city = Maybe Text
a} :: Address)
address_address1 :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_address1 :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_address1 = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
address1 :: Maybe Text
$sel:address1:Address' :: Address -> Maybe Text
address1} -> Maybe Text
address1) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:address1:Address' :: Maybe Text
address1 = Maybe Text
a} :: Address)
address_province :: Lens.Lens' Address (Prelude.Maybe Prelude.Text)
address_province :: (Maybe Text -> f (Maybe Text)) -> Address -> f Address
address_province = (Address -> Maybe Text)
-> (Address -> Maybe Text -> Address)
-> Lens Address Address (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Maybe Text
province :: Maybe Text
$sel:province:Address' :: Address -> Maybe Text
province} -> Maybe Text
province) (\s :: Address
s@Address' {} Maybe Text
a -> Address
s {$sel:province:Address' :: Maybe Text
province = Maybe Text
a} :: Address)
instance Core.FromJSON Address where
parseJSON :: Value -> Parser Address
parseJSON =
String -> (Object -> Parser Address) -> Value -> Parser Address
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Address"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address
Address'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Address2")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Address4")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"County")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Address3")
Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Address)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PostalCode")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Address)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Country")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> Address)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"City")
Parser (Maybe Text -> Maybe Text -> Address)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Address)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Address1")
Parser (Maybe Text -> Address)
-> Parser (Maybe Text) -> Parser Address
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Province")
)
instance Prelude.Hashable Address
instance Prelude.NFData Address
instance Core.ToJSON Address where
toJSON :: Address -> Value
toJSON Address' {Maybe Text
province :: Maybe Text
address1 :: Maybe Text
city :: Maybe Text
country :: Maybe Text
postalCode :: Maybe Text
address3 :: Maybe Text
county :: Maybe Text
address4 :: Maybe Text
state :: Maybe Text
address2 :: Maybe Text
$sel:province:Address' :: Address -> Maybe Text
$sel:address1:Address' :: Address -> Maybe Text
$sel:city:Address' :: Address -> Maybe Text
$sel:country:Address' :: Address -> Maybe Text
$sel:postalCode:Address' :: Address -> Maybe Text
$sel:address3:Address' :: Address -> Maybe Text
$sel:county:Address' :: Address -> Maybe Text
$sel:address4:Address' :: Address -> Maybe Text
$sel:state:Address' :: Address -> Maybe Text
$sel:address2:Address' :: Address -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Address2" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
address2,
(Text
"State" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
state,
(Text
"Address4" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
address4,
(Text
"County" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
county,
(Text
"Address3" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
address3,
(Text
"PostalCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
postalCode,
(Text
"Country" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
country,
(Text
"City" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
city,
(Text
"Address1" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
address1,
(Text
"Province" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
province
]
)