{-# 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.UpdatePhoneNumberRequestItem
-- 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.Chime.Types.UpdatePhoneNumberRequestItem where

import Amazonka.Chime.Types.PhoneNumberProductType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The phone number ID, product type, or calling name fields to update,
-- used with the BatchUpdatePhoneNumber and UpdatePhoneNumber actions.
--
-- /See:/ 'newUpdatePhoneNumberRequestItem' smart constructor.
data UpdatePhoneNumberRequestItem = UpdatePhoneNumberRequestItem'
  { -- | The product type to update.
    UpdatePhoneNumberRequestItem -> Maybe PhoneNumberProductType
productType :: Prelude.Maybe PhoneNumberProductType,
    -- | The outbound calling name to update.
    UpdatePhoneNumberRequestItem -> Maybe (Sensitive Text)
callingName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The phone number ID to update.
    UpdatePhoneNumberRequestItem -> Text
phoneNumberId :: Prelude.Text
  }
  deriving (UpdatePhoneNumberRequestItem
-> UpdatePhoneNumberRequestItem -> Bool
(UpdatePhoneNumberRequestItem
 -> UpdatePhoneNumberRequestItem -> Bool)
-> (UpdatePhoneNumberRequestItem
    -> UpdatePhoneNumberRequestItem -> Bool)
-> Eq UpdatePhoneNumberRequestItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePhoneNumberRequestItem
-> UpdatePhoneNumberRequestItem -> Bool
$c/= :: UpdatePhoneNumberRequestItem
-> UpdatePhoneNumberRequestItem -> Bool
== :: UpdatePhoneNumberRequestItem
-> UpdatePhoneNumberRequestItem -> Bool
$c== :: UpdatePhoneNumberRequestItem
-> UpdatePhoneNumberRequestItem -> Bool
Prelude.Eq, Int -> UpdatePhoneNumberRequestItem -> ShowS
[UpdatePhoneNumberRequestItem] -> ShowS
UpdatePhoneNumberRequestItem -> String
(Int -> UpdatePhoneNumberRequestItem -> ShowS)
-> (UpdatePhoneNumberRequestItem -> String)
-> ([UpdatePhoneNumberRequestItem] -> ShowS)
-> Show UpdatePhoneNumberRequestItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePhoneNumberRequestItem] -> ShowS
$cshowList :: [UpdatePhoneNumberRequestItem] -> ShowS
show :: UpdatePhoneNumberRequestItem -> String
$cshow :: UpdatePhoneNumberRequestItem -> String
showsPrec :: Int -> UpdatePhoneNumberRequestItem -> ShowS
$cshowsPrec :: Int -> UpdatePhoneNumberRequestItem -> ShowS
Prelude.Show, (forall x.
 UpdatePhoneNumberRequestItem -> Rep UpdatePhoneNumberRequestItem x)
-> (forall x.
    Rep UpdatePhoneNumberRequestItem x -> UpdatePhoneNumberRequestItem)
-> Generic UpdatePhoneNumberRequestItem
forall x.
Rep UpdatePhoneNumberRequestItem x -> UpdatePhoneNumberRequestItem
forall x.
UpdatePhoneNumberRequestItem -> Rep UpdatePhoneNumberRequestItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdatePhoneNumberRequestItem x -> UpdatePhoneNumberRequestItem
$cfrom :: forall x.
UpdatePhoneNumberRequestItem -> Rep UpdatePhoneNumberRequestItem x
Prelude.Generic)

-- |
-- Create a value of 'UpdatePhoneNumberRequestItem' 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:
--
-- 'productType', 'updatePhoneNumberRequestItem_productType' - The product type to update.
--
-- 'callingName', 'updatePhoneNumberRequestItem_callingName' - The outbound calling name to update.
--
-- 'phoneNumberId', 'updatePhoneNumberRequestItem_phoneNumberId' - The phone number ID to update.
newUpdatePhoneNumberRequestItem ::
  -- | 'phoneNumberId'
  Prelude.Text ->
  UpdatePhoneNumberRequestItem
newUpdatePhoneNumberRequestItem :: Text -> UpdatePhoneNumberRequestItem
newUpdatePhoneNumberRequestItem Text
pPhoneNumberId_ =
  UpdatePhoneNumberRequestItem' :: Maybe PhoneNumberProductType
-> Maybe (Sensitive Text) -> Text -> UpdatePhoneNumberRequestItem
UpdatePhoneNumberRequestItem'
    { $sel:productType:UpdatePhoneNumberRequestItem' :: Maybe PhoneNumberProductType
productType =
        Maybe PhoneNumberProductType
forall a. Maybe a
Prelude.Nothing,
      $sel:callingName:UpdatePhoneNumberRequestItem' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberId:UpdatePhoneNumberRequestItem' :: Text
phoneNumberId = Text
pPhoneNumberId_
    }

-- | The product type to update.
updatePhoneNumberRequestItem_productType :: Lens.Lens' UpdatePhoneNumberRequestItem (Prelude.Maybe PhoneNumberProductType)
updatePhoneNumberRequestItem_productType :: (Maybe PhoneNumberProductType -> f (Maybe PhoneNumberProductType))
-> UpdatePhoneNumberRequestItem -> f UpdatePhoneNumberRequestItem
updatePhoneNumberRequestItem_productType = (UpdatePhoneNumberRequestItem -> Maybe PhoneNumberProductType)
-> (UpdatePhoneNumberRequestItem
    -> Maybe PhoneNumberProductType -> UpdatePhoneNumberRequestItem)
-> Lens
     UpdatePhoneNumberRequestItem
     UpdatePhoneNumberRequestItem
     (Maybe PhoneNumberProductType)
     (Maybe PhoneNumberProductType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePhoneNumberRequestItem' {Maybe PhoneNumberProductType
productType :: Maybe PhoneNumberProductType
$sel:productType:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Maybe PhoneNumberProductType
productType} -> Maybe PhoneNumberProductType
productType) (\s :: UpdatePhoneNumberRequestItem
s@UpdatePhoneNumberRequestItem' {} Maybe PhoneNumberProductType
a -> UpdatePhoneNumberRequestItem
s {$sel:productType:UpdatePhoneNumberRequestItem' :: Maybe PhoneNumberProductType
productType = Maybe PhoneNumberProductType
a} :: UpdatePhoneNumberRequestItem)

-- | The outbound calling name to update.
updatePhoneNumberRequestItem_callingName :: Lens.Lens' UpdatePhoneNumberRequestItem (Prelude.Maybe Prelude.Text)
updatePhoneNumberRequestItem_callingName :: (Maybe Text -> f (Maybe Text))
-> UpdatePhoneNumberRequestItem -> f UpdatePhoneNumberRequestItem
updatePhoneNumberRequestItem_callingName = (UpdatePhoneNumberRequestItem -> Maybe (Sensitive Text))
-> (UpdatePhoneNumberRequestItem
    -> Maybe (Sensitive Text) -> UpdatePhoneNumberRequestItem)
-> Lens
     UpdatePhoneNumberRequestItem
     UpdatePhoneNumberRequestItem
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePhoneNumberRequestItem' {Maybe (Sensitive Text)
callingName :: Maybe (Sensitive Text)
$sel:callingName:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Maybe (Sensitive Text)
callingName} -> Maybe (Sensitive Text)
callingName) (\s :: UpdatePhoneNumberRequestItem
s@UpdatePhoneNumberRequestItem' {} Maybe (Sensitive Text)
a -> UpdatePhoneNumberRequestItem
s {$sel:callingName:UpdatePhoneNumberRequestItem' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
a} :: UpdatePhoneNumberRequestItem) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UpdatePhoneNumberRequestItem -> f UpdatePhoneNumberRequestItem)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdatePhoneNumberRequestItem
-> f UpdatePhoneNumberRequestItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The phone number ID to update.
updatePhoneNumberRequestItem_phoneNumberId :: Lens.Lens' UpdatePhoneNumberRequestItem Prelude.Text
updatePhoneNumberRequestItem_phoneNumberId :: (Text -> f Text)
-> UpdatePhoneNumberRequestItem -> f UpdatePhoneNumberRequestItem
updatePhoneNumberRequestItem_phoneNumberId = (UpdatePhoneNumberRequestItem -> Text)
-> (UpdatePhoneNumberRequestItem
    -> Text -> UpdatePhoneNumberRequestItem)
-> Lens
     UpdatePhoneNumberRequestItem UpdatePhoneNumberRequestItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePhoneNumberRequestItem' {Text
phoneNumberId :: Text
$sel:phoneNumberId:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Text
phoneNumberId} -> Text
phoneNumberId) (\s :: UpdatePhoneNumberRequestItem
s@UpdatePhoneNumberRequestItem' {} Text
a -> UpdatePhoneNumberRequestItem
s {$sel:phoneNumberId:UpdatePhoneNumberRequestItem' :: Text
phoneNumberId = Text
a} :: UpdatePhoneNumberRequestItem)

instance
  Prelude.Hashable
    UpdatePhoneNumberRequestItem

instance Prelude.NFData UpdatePhoneNumberRequestItem

instance Core.ToJSON UpdatePhoneNumberRequestItem where
  toJSON :: UpdatePhoneNumberRequestItem -> Value
toJSON UpdatePhoneNumberRequestItem' {Maybe (Sensitive Text)
Maybe PhoneNumberProductType
Text
phoneNumberId :: Text
callingName :: Maybe (Sensitive Text)
productType :: Maybe PhoneNumberProductType
$sel:phoneNumberId:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Text
$sel:callingName:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Maybe (Sensitive Text)
$sel:productType:UpdatePhoneNumberRequestItem' :: UpdatePhoneNumberRequestItem -> Maybe PhoneNumberProductType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProductType" Text -> PhoneNumberProductType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PhoneNumberProductType -> Pair)
-> Maybe PhoneNumberProductType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PhoneNumberProductType
productType,
            (Text
"CallingName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
callingName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PhoneNumberId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
phoneNumberId)
          ]
      )