{-# 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.Chime.Types.PhoneNumberAssociation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Chime.Types.PhoneNumberAssociation where

import Amazonka.Chime.Types.PhoneNumberAssociationName
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The phone number associations, such as Amazon Chime account ID, Amazon
-- Chime user ID, Amazon Chime Voice Connector ID, or Amazon Chime Voice
-- Connector group ID.
--
-- /See:/ 'newPhoneNumberAssociation' smart constructor.
data PhoneNumberAssociation = PhoneNumberAssociation'
  { -- | The timestamp of the phone number association, in ISO 8601 format.
    PhoneNumberAssociation -> Maybe ISO8601
associatedTimestamp :: Prelude.Maybe Data.ISO8601,
    -- | Defines the association with an Amazon Chime account ID, user ID, Amazon
    -- Chime Voice Connector ID, or Amazon Chime Voice Connector group ID.
    PhoneNumberAssociation -> Maybe PhoneNumberAssociationName
name :: Prelude.Maybe PhoneNumberAssociationName,
    -- | Contains the ID for the entity specified in Name.
    PhoneNumberAssociation -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (PhoneNumberAssociation -> PhoneNumberAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberAssociation -> PhoneNumberAssociation -> Bool
$c/= :: PhoneNumberAssociation -> PhoneNumberAssociation -> Bool
== :: PhoneNumberAssociation -> PhoneNumberAssociation -> Bool
$c== :: PhoneNumberAssociation -> PhoneNumberAssociation -> Bool
Prelude.Eq, ReadPrec [PhoneNumberAssociation]
ReadPrec PhoneNumberAssociation
Int -> ReadS PhoneNumberAssociation
ReadS [PhoneNumberAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhoneNumberAssociation]
$creadListPrec :: ReadPrec [PhoneNumberAssociation]
readPrec :: ReadPrec PhoneNumberAssociation
$creadPrec :: ReadPrec PhoneNumberAssociation
readList :: ReadS [PhoneNumberAssociation]
$creadList :: ReadS [PhoneNumberAssociation]
readsPrec :: Int -> ReadS PhoneNumberAssociation
$creadsPrec :: Int -> ReadS PhoneNumberAssociation
Prelude.Read, Int -> PhoneNumberAssociation -> ShowS
[PhoneNumberAssociation] -> ShowS
PhoneNumberAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberAssociation] -> ShowS
$cshowList :: [PhoneNumberAssociation] -> ShowS
show :: PhoneNumberAssociation -> String
$cshow :: PhoneNumberAssociation -> String
showsPrec :: Int -> PhoneNumberAssociation -> ShowS
$cshowsPrec :: Int -> PhoneNumberAssociation -> ShowS
Prelude.Show, forall x. Rep PhoneNumberAssociation x -> PhoneNumberAssociation
forall x. PhoneNumberAssociation -> Rep PhoneNumberAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberAssociation x -> PhoneNumberAssociation
$cfrom :: forall x. PhoneNumberAssociation -> Rep PhoneNumberAssociation x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumberAssociation' 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:
--
-- 'associatedTimestamp', 'phoneNumberAssociation_associatedTimestamp' - The timestamp of the phone number association, in ISO 8601 format.
--
-- 'name', 'phoneNumberAssociation_name' - Defines the association with an Amazon Chime account ID, user ID, Amazon
-- Chime Voice Connector ID, or Amazon Chime Voice Connector group ID.
--
-- 'value', 'phoneNumberAssociation_value' - Contains the ID for the entity specified in Name.
newPhoneNumberAssociation ::
  PhoneNumberAssociation
newPhoneNumberAssociation :: PhoneNumberAssociation
newPhoneNumberAssociation =
  PhoneNumberAssociation'
    { $sel:associatedTimestamp:PhoneNumberAssociation' :: Maybe ISO8601
associatedTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:PhoneNumberAssociation' :: Maybe PhoneNumberAssociationName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:value:PhoneNumberAssociation' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of the phone number association, in ISO 8601 format.
phoneNumberAssociation_associatedTimestamp :: Lens.Lens' PhoneNumberAssociation (Prelude.Maybe Prelude.UTCTime)
phoneNumberAssociation_associatedTimestamp :: Lens' PhoneNumberAssociation (Maybe UTCTime)
phoneNumberAssociation_associatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberAssociation' {Maybe ISO8601
associatedTimestamp :: Maybe ISO8601
$sel:associatedTimestamp:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe ISO8601
associatedTimestamp} -> Maybe ISO8601
associatedTimestamp) (\s :: PhoneNumberAssociation
s@PhoneNumberAssociation' {} Maybe ISO8601
a -> PhoneNumberAssociation
s {$sel:associatedTimestamp:PhoneNumberAssociation' :: Maybe ISO8601
associatedTimestamp = Maybe ISO8601
a} :: PhoneNumberAssociation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Defines the association with an Amazon Chime account ID, user ID, Amazon
-- Chime Voice Connector ID, or Amazon Chime Voice Connector group ID.
phoneNumberAssociation_name :: Lens.Lens' PhoneNumberAssociation (Prelude.Maybe PhoneNumberAssociationName)
phoneNumberAssociation_name :: Lens' PhoneNumberAssociation (Maybe PhoneNumberAssociationName)
phoneNumberAssociation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberAssociation' {Maybe PhoneNumberAssociationName
name :: Maybe PhoneNumberAssociationName
$sel:name:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe PhoneNumberAssociationName
name} -> Maybe PhoneNumberAssociationName
name) (\s :: PhoneNumberAssociation
s@PhoneNumberAssociation' {} Maybe PhoneNumberAssociationName
a -> PhoneNumberAssociation
s {$sel:name:PhoneNumberAssociation' :: Maybe PhoneNumberAssociationName
name = Maybe PhoneNumberAssociationName
a} :: PhoneNumberAssociation)

-- | Contains the ID for the entity specified in Name.
phoneNumberAssociation_value :: Lens.Lens' PhoneNumberAssociation (Prelude.Maybe Prelude.Text)
phoneNumberAssociation_value :: Lens' PhoneNumberAssociation (Maybe Text)
phoneNumberAssociation_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberAssociation' {Maybe Text
value :: Maybe Text
$sel:value:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe Text
value} -> Maybe Text
value) (\s :: PhoneNumberAssociation
s@PhoneNumberAssociation' {} Maybe Text
a -> PhoneNumberAssociation
s {$sel:value:PhoneNumberAssociation' :: Maybe Text
value = Maybe Text
a} :: PhoneNumberAssociation)

instance Data.FromJSON PhoneNumberAssociation where
  parseJSON :: Value -> Parser PhoneNumberAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PhoneNumberAssociation"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe PhoneNumberAssociationName
-> Maybe Text
-> PhoneNumberAssociation
PhoneNumberAssociation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AssociatedTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Value")
      )

instance Prelude.Hashable PhoneNumberAssociation where
  hashWithSalt :: Int -> PhoneNumberAssociation -> Int
hashWithSalt Int
_salt PhoneNumberAssociation' {Maybe Text
Maybe ISO8601
Maybe PhoneNumberAssociationName
value :: Maybe Text
name :: Maybe PhoneNumberAssociationName
associatedTimestamp :: Maybe ISO8601
$sel:value:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe Text
$sel:name:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe PhoneNumberAssociationName
$sel:associatedTimestamp:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
associatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PhoneNumberAssociationName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData PhoneNumberAssociation where
  rnf :: PhoneNumberAssociation -> ()
rnf PhoneNumberAssociation' {Maybe Text
Maybe ISO8601
Maybe PhoneNumberAssociationName
value :: Maybe Text
name :: Maybe PhoneNumberAssociationName
associatedTimestamp :: Maybe ISO8601
$sel:value:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe Text
$sel:name:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe PhoneNumberAssociationName
$sel:associatedTimestamp:PhoneNumberAssociation' :: PhoneNumberAssociation -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
associatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PhoneNumberAssociationName
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value