{-# 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.CustomerProfiles.Types.UpdateAddress
-- 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.CustomerProfiles.Types.UpdateAddress where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Updates associated with the address properties of a customer profile.
--
-- /See:/ 'newUpdateAddress' smart constructor.
data UpdateAddress = UpdateAddress'
  { -- | The second line of a customer address.
    UpdateAddress -> Maybe Text
address2 :: Prelude.Maybe Prelude.Text,
    -- | The state in which a customer lives.
    UpdateAddress -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The fourth line of a customer address.
    UpdateAddress -> Maybe Text
address4 :: Prelude.Maybe Prelude.Text,
    -- | The county in which a customer lives.
    UpdateAddress -> Maybe Text
county :: Prelude.Maybe Prelude.Text,
    -- | The third line of a customer address.
    UpdateAddress -> Maybe Text
address3 :: Prelude.Maybe Prelude.Text,
    -- | The postal code of a customer address.
    UpdateAddress -> Maybe Text
postalCode :: Prelude.Maybe Prelude.Text,
    -- | The country in which a customer lives.
    UpdateAddress -> Maybe Text
country :: Prelude.Maybe Prelude.Text,
    -- | The city in which a customer lives.
    UpdateAddress -> Maybe Text
city :: Prelude.Maybe Prelude.Text,
    -- | The first line of a customer address.
    UpdateAddress -> Maybe Text
address1 :: Prelude.Maybe Prelude.Text,
    -- | The province in which a customer lives.
    UpdateAddress -> Maybe Text
province :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateAddress -> UpdateAddress -> Bool
(UpdateAddress -> UpdateAddress -> Bool)
-> (UpdateAddress -> UpdateAddress -> Bool) -> Eq UpdateAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAddress -> UpdateAddress -> Bool
$c/= :: UpdateAddress -> UpdateAddress -> Bool
== :: UpdateAddress -> UpdateAddress -> Bool
$c== :: UpdateAddress -> UpdateAddress -> Bool
Prelude.Eq, ReadPrec [UpdateAddress]
ReadPrec UpdateAddress
Int -> ReadS UpdateAddress
ReadS [UpdateAddress]
(Int -> ReadS UpdateAddress)
-> ReadS [UpdateAddress]
-> ReadPrec UpdateAddress
-> ReadPrec [UpdateAddress]
-> Read UpdateAddress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAddress]
$creadListPrec :: ReadPrec [UpdateAddress]
readPrec :: ReadPrec UpdateAddress
$creadPrec :: ReadPrec UpdateAddress
readList :: ReadS [UpdateAddress]
$creadList :: ReadS [UpdateAddress]
readsPrec :: Int -> ReadS UpdateAddress
$creadsPrec :: Int -> ReadS UpdateAddress
Prelude.Read, Int -> UpdateAddress -> ShowS
[UpdateAddress] -> ShowS
UpdateAddress -> String
(Int -> UpdateAddress -> ShowS)
-> (UpdateAddress -> String)
-> ([UpdateAddress] -> ShowS)
-> Show UpdateAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAddress] -> ShowS
$cshowList :: [UpdateAddress] -> ShowS
show :: UpdateAddress -> String
$cshow :: UpdateAddress -> String
showsPrec :: Int -> UpdateAddress -> ShowS
$cshowsPrec :: Int -> UpdateAddress -> ShowS
Prelude.Show, (forall x. UpdateAddress -> Rep UpdateAddress x)
-> (forall x. Rep UpdateAddress x -> UpdateAddress)
-> Generic UpdateAddress
forall x. Rep UpdateAddress x -> UpdateAddress
forall x. UpdateAddress -> Rep UpdateAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAddress x -> UpdateAddress
$cfrom :: forall x. UpdateAddress -> Rep UpdateAddress x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAddress' 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:
--
-- 'address2', 'updateAddress_address2' - The second line of a customer address.
--
-- 'state', 'updateAddress_state' - The state in which a customer lives.
--
-- 'address4', 'updateAddress_address4' - The fourth line of a customer address.
--
-- 'county', 'updateAddress_county' - The county in which a customer lives.
--
-- 'address3', 'updateAddress_address3' - The third line of a customer address.
--
-- 'postalCode', 'updateAddress_postalCode' - The postal code of a customer address.
--
-- 'country', 'updateAddress_country' - The country in which a customer lives.
--
-- 'city', 'updateAddress_city' - The city in which a customer lives.
--
-- 'address1', 'updateAddress_address1' - The first line of a customer address.
--
-- 'province', 'updateAddress_province' - The province in which a customer lives.
newUpdateAddress ::
  UpdateAddress
newUpdateAddress :: UpdateAddress
newUpdateAddress =
  UpdateAddress' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UpdateAddress
UpdateAddress'
    { $sel:address2:UpdateAddress' :: Maybe Text
address2 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:UpdateAddress' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:address4:UpdateAddress' :: Maybe Text
address4 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:county:UpdateAddress' :: Maybe Text
county = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:address3:UpdateAddress' :: Maybe Text
address3 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:postalCode:UpdateAddress' :: Maybe Text
postalCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:country:UpdateAddress' :: Maybe Text
country = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:city:UpdateAddress' :: Maybe Text
city = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:address1:UpdateAddress' :: Maybe Text
address1 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:province:UpdateAddress' :: Maybe Text
province = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The second line of a customer address.
updateAddress_address2 :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_address2 :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_address2 = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
address2 :: Maybe Text
$sel:address2:UpdateAddress' :: UpdateAddress -> Maybe Text
address2} -> Maybe Text
address2) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:address2:UpdateAddress' :: Maybe Text
address2 = Maybe Text
a} :: UpdateAddress)

-- | The state in which a customer lives.
updateAddress_state :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_state :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_state = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
state :: Maybe Text
$sel:state:UpdateAddress' :: UpdateAddress -> Maybe Text
state} -> Maybe Text
state) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:state:UpdateAddress' :: Maybe Text
state = Maybe Text
a} :: UpdateAddress)

-- | The fourth line of a customer address.
updateAddress_address4 :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_address4 :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_address4 = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
address4 :: Maybe Text
$sel:address4:UpdateAddress' :: UpdateAddress -> Maybe Text
address4} -> Maybe Text
address4) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:address4:UpdateAddress' :: Maybe Text
address4 = Maybe Text
a} :: UpdateAddress)

-- | The county in which a customer lives.
updateAddress_county :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_county :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_county = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
county :: Maybe Text
$sel:county:UpdateAddress' :: UpdateAddress -> Maybe Text
county} -> Maybe Text
county) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:county:UpdateAddress' :: Maybe Text
county = Maybe Text
a} :: UpdateAddress)

-- | The third line of a customer address.
updateAddress_address3 :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_address3 :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_address3 = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
address3 :: Maybe Text
$sel:address3:UpdateAddress' :: UpdateAddress -> Maybe Text
address3} -> Maybe Text
address3) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:address3:UpdateAddress' :: Maybe Text
address3 = Maybe Text
a} :: UpdateAddress)

-- | The postal code of a customer address.
updateAddress_postalCode :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_postalCode :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_postalCode = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
postalCode :: Maybe Text
$sel:postalCode:UpdateAddress' :: UpdateAddress -> Maybe Text
postalCode} -> Maybe Text
postalCode) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:postalCode:UpdateAddress' :: Maybe Text
postalCode = Maybe Text
a} :: UpdateAddress)

-- | The country in which a customer lives.
updateAddress_country :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_country :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_country = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
country :: Maybe Text
$sel:country:UpdateAddress' :: UpdateAddress -> Maybe Text
country} -> Maybe Text
country) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:country:UpdateAddress' :: Maybe Text
country = Maybe Text
a} :: UpdateAddress)

-- | The city in which a customer lives.
updateAddress_city :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_city :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_city = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
city :: Maybe Text
$sel:city:UpdateAddress' :: UpdateAddress -> Maybe Text
city} -> Maybe Text
city) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:city:UpdateAddress' :: Maybe Text
city = Maybe Text
a} :: UpdateAddress)

-- | The first line of a customer address.
updateAddress_address1 :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_address1 :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_address1 = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
address1 :: Maybe Text
$sel:address1:UpdateAddress' :: UpdateAddress -> Maybe Text
address1} -> Maybe Text
address1) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:address1:UpdateAddress' :: Maybe Text
address1 = Maybe Text
a} :: UpdateAddress)

-- | The province in which a customer lives.
updateAddress_province :: Lens.Lens' UpdateAddress (Prelude.Maybe Prelude.Text)
updateAddress_province :: (Maybe Text -> f (Maybe Text)) -> UpdateAddress -> f UpdateAddress
updateAddress_province = (UpdateAddress -> Maybe Text)
-> (UpdateAddress -> Maybe Text -> UpdateAddress)
-> Lens UpdateAddress UpdateAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddress' {Maybe Text
province :: Maybe Text
$sel:province:UpdateAddress' :: UpdateAddress -> Maybe Text
province} -> Maybe Text
province) (\s :: UpdateAddress
s@UpdateAddress' {} Maybe Text
a -> UpdateAddress
s {$sel:province:UpdateAddress' :: Maybe Text
province = Maybe Text
a} :: UpdateAddress)

instance Prelude.Hashable UpdateAddress

instance Prelude.NFData UpdateAddress

instance Core.ToJSON UpdateAddress where
  toJSON :: UpdateAddress -> Value
toJSON UpdateAddress' {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:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:address1:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:city:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:country:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:postalCode:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:address3:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:county:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:address4:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:state:UpdateAddress' :: UpdateAddress -> Maybe Text
$sel:address2:UpdateAddress' :: UpdateAddress -> 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
          ]
      )