{-# 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.AlexaBusiness.Types.AddressBookData
-- 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.AlexaBusiness.Types.AddressBookData where

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

-- | Information related to an address book.
--
-- /See:/ 'newAddressBookData' smart constructor.
data AddressBookData = AddressBookData'
  { -- | The ARN of the address book.
    AddressBookData -> Maybe Text
addressBookArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the address book.
    AddressBookData -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The description of the address book.
    AddressBookData -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (AddressBookData -> AddressBookData -> Bool
(AddressBookData -> AddressBookData -> Bool)
-> (AddressBookData -> AddressBookData -> Bool)
-> Eq AddressBookData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddressBookData -> AddressBookData -> Bool
$c/= :: AddressBookData -> AddressBookData -> Bool
== :: AddressBookData -> AddressBookData -> Bool
$c== :: AddressBookData -> AddressBookData -> Bool
Prelude.Eq, ReadPrec [AddressBookData]
ReadPrec AddressBookData
Int -> ReadS AddressBookData
ReadS [AddressBookData]
(Int -> ReadS AddressBookData)
-> ReadS [AddressBookData]
-> ReadPrec AddressBookData
-> ReadPrec [AddressBookData]
-> Read AddressBookData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddressBookData]
$creadListPrec :: ReadPrec [AddressBookData]
readPrec :: ReadPrec AddressBookData
$creadPrec :: ReadPrec AddressBookData
readList :: ReadS [AddressBookData]
$creadList :: ReadS [AddressBookData]
readsPrec :: Int -> ReadS AddressBookData
$creadsPrec :: Int -> ReadS AddressBookData
Prelude.Read, Int -> AddressBookData -> ShowS
[AddressBookData] -> ShowS
AddressBookData -> String
(Int -> AddressBookData -> ShowS)
-> (AddressBookData -> String)
-> ([AddressBookData] -> ShowS)
-> Show AddressBookData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddressBookData] -> ShowS
$cshowList :: [AddressBookData] -> ShowS
show :: AddressBookData -> String
$cshow :: AddressBookData -> String
showsPrec :: Int -> AddressBookData -> ShowS
$cshowsPrec :: Int -> AddressBookData -> ShowS
Prelude.Show, (forall x. AddressBookData -> Rep AddressBookData x)
-> (forall x. Rep AddressBookData x -> AddressBookData)
-> Generic AddressBookData
forall x. Rep AddressBookData x -> AddressBookData
forall x. AddressBookData -> Rep AddressBookData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddressBookData x -> AddressBookData
$cfrom :: forall x. AddressBookData -> Rep AddressBookData x
Prelude.Generic)

-- |
-- Create a value of 'AddressBookData' 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:
--
-- 'addressBookArn', 'addressBookData_addressBookArn' - The ARN of the address book.
--
-- 'name', 'addressBookData_name' - The name of the address book.
--
-- 'description', 'addressBookData_description' - The description of the address book.
newAddressBookData ::
  AddressBookData
newAddressBookData :: AddressBookData
newAddressBookData =
  AddressBookData' :: Maybe Text -> Maybe Text -> Maybe Text -> AddressBookData
AddressBookData'
    { $sel:addressBookArn:AddressBookData' :: Maybe Text
addressBookArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AddressBookData' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:AddressBookData' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the address book.
addressBookData_addressBookArn :: Lens.Lens' AddressBookData (Prelude.Maybe Prelude.Text)
addressBookData_addressBookArn :: (Maybe Text -> f (Maybe Text))
-> AddressBookData -> f AddressBookData
addressBookData_addressBookArn = (AddressBookData -> Maybe Text)
-> (AddressBookData -> Maybe Text -> AddressBookData)
-> Lens AddressBookData AddressBookData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressBookData' {Maybe Text
addressBookArn :: Maybe Text
$sel:addressBookArn:AddressBookData' :: AddressBookData -> Maybe Text
addressBookArn} -> Maybe Text
addressBookArn) (\s :: AddressBookData
s@AddressBookData' {} Maybe Text
a -> AddressBookData
s {$sel:addressBookArn:AddressBookData' :: Maybe Text
addressBookArn = Maybe Text
a} :: AddressBookData)

-- | The name of the address book.
addressBookData_name :: Lens.Lens' AddressBookData (Prelude.Maybe Prelude.Text)
addressBookData_name :: (Maybe Text -> f (Maybe Text))
-> AddressBookData -> f AddressBookData
addressBookData_name = (AddressBookData -> Maybe Text)
-> (AddressBookData -> Maybe Text -> AddressBookData)
-> Lens AddressBookData AddressBookData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressBookData' {Maybe Text
name :: Maybe Text
$sel:name:AddressBookData' :: AddressBookData -> Maybe Text
name} -> Maybe Text
name) (\s :: AddressBookData
s@AddressBookData' {} Maybe Text
a -> AddressBookData
s {$sel:name:AddressBookData' :: Maybe Text
name = Maybe Text
a} :: AddressBookData)

-- | The description of the address book.
addressBookData_description :: Lens.Lens' AddressBookData (Prelude.Maybe Prelude.Text)
addressBookData_description :: (Maybe Text -> f (Maybe Text))
-> AddressBookData -> f AddressBookData
addressBookData_description = (AddressBookData -> Maybe Text)
-> (AddressBookData -> Maybe Text -> AddressBookData)
-> Lens AddressBookData AddressBookData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressBookData' {Maybe Text
description :: Maybe Text
$sel:description:AddressBookData' :: AddressBookData -> Maybe Text
description} -> Maybe Text
description) (\s :: AddressBookData
s@AddressBookData' {} Maybe Text
a -> AddressBookData
s {$sel:description:AddressBookData' :: Maybe Text
description = Maybe Text
a} :: AddressBookData)

instance Core.FromJSON AddressBookData where
  parseJSON :: Value -> Parser AddressBookData
parseJSON =
    String
-> (Object -> Parser AddressBookData)
-> Value
-> Parser AddressBookData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AddressBookData"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> AddressBookData
AddressBookData'
            (Maybe Text -> Maybe Text -> Maybe Text -> AddressBookData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AddressBookData)
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
"AddressBookArn")
            Parser (Maybe Text -> Maybe Text -> AddressBookData)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AddressBookData)
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
"Name")
            Parser (Maybe Text -> AddressBookData)
-> Parser (Maybe Text) -> Parser AddressBookData
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
"Description")
      )

instance Prelude.Hashable AddressBookData

instance Prelude.NFData AddressBookData