{-# 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.OrderedPhoneNumber
-- 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.OrderedPhoneNumber where

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

-- | A phone number for which an order has been placed.
--
-- /See:/ 'newOrderedPhoneNumber' smart constructor.
data OrderedPhoneNumber = OrderedPhoneNumber'
  { -- | The phone number status.
    OrderedPhoneNumber -> Maybe OrderedPhoneNumberStatus
status :: Prelude.Maybe OrderedPhoneNumberStatus,
    -- | The phone number, in E.164 format.
    OrderedPhoneNumber -> Maybe (Sensitive Text)
e164PhoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (OrderedPhoneNumber -> OrderedPhoneNumber -> Bool
(OrderedPhoneNumber -> OrderedPhoneNumber -> Bool)
-> (OrderedPhoneNumber -> OrderedPhoneNumber -> Bool)
-> Eq OrderedPhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderedPhoneNumber -> OrderedPhoneNumber -> Bool
$c/= :: OrderedPhoneNumber -> OrderedPhoneNumber -> Bool
== :: OrderedPhoneNumber -> OrderedPhoneNumber -> Bool
$c== :: OrderedPhoneNumber -> OrderedPhoneNumber -> Bool
Prelude.Eq, Int -> OrderedPhoneNumber -> ShowS
[OrderedPhoneNumber] -> ShowS
OrderedPhoneNumber -> String
(Int -> OrderedPhoneNumber -> ShowS)
-> (OrderedPhoneNumber -> String)
-> ([OrderedPhoneNumber] -> ShowS)
-> Show OrderedPhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderedPhoneNumber] -> ShowS
$cshowList :: [OrderedPhoneNumber] -> ShowS
show :: OrderedPhoneNumber -> String
$cshow :: OrderedPhoneNumber -> String
showsPrec :: Int -> OrderedPhoneNumber -> ShowS
$cshowsPrec :: Int -> OrderedPhoneNumber -> ShowS
Prelude.Show, (forall x. OrderedPhoneNumber -> Rep OrderedPhoneNumber x)
-> (forall x. Rep OrderedPhoneNumber x -> OrderedPhoneNumber)
-> Generic OrderedPhoneNumber
forall x. Rep OrderedPhoneNumber x -> OrderedPhoneNumber
forall x. OrderedPhoneNumber -> Rep OrderedPhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrderedPhoneNumber x -> OrderedPhoneNumber
$cfrom :: forall x. OrderedPhoneNumber -> Rep OrderedPhoneNumber x
Prelude.Generic)

-- |
-- Create a value of 'OrderedPhoneNumber' 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:
--
-- 'status', 'orderedPhoneNumber_status' - The phone number status.
--
-- 'e164PhoneNumber', 'orderedPhoneNumber_e164PhoneNumber' - The phone number, in E.164 format.
newOrderedPhoneNumber ::
  OrderedPhoneNumber
newOrderedPhoneNumber :: OrderedPhoneNumber
newOrderedPhoneNumber =
  OrderedPhoneNumber' :: Maybe OrderedPhoneNumberStatus
-> Maybe (Sensitive Text) -> OrderedPhoneNumber
OrderedPhoneNumber'
    { $sel:status:OrderedPhoneNumber' :: Maybe OrderedPhoneNumberStatus
status = Maybe OrderedPhoneNumberStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:e164PhoneNumber:OrderedPhoneNumber' :: Maybe (Sensitive Text)
e164PhoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The phone number status.
orderedPhoneNumber_status :: Lens.Lens' OrderedPhoneNumber (Prelude.Maybe OrderedPhoneNumberStatus)
orderedPhoneNumber_status :: (Maybe OrderedPhoneNumberStatus
 -> f (Maybe OrderedPhoneNumberStatus))
-> OrderedPhoneNumber -> f OrderedPhoneNumber
orderedPhoneNumber_status = (OrderedPhoneNumber -> Maybe OrderedPhoneNumberStatus)
-> (OrderedPhoneNumber
    -> Maybe OrderedPhoneNumberStatus -> OrderedPhoneNumber)
-> Lens
     OrderedPhoneNumber
     OrderedPhoneNumber
     (Maybe OrderedPhoneNumberStatus)
     (Maybe OrderedPhoneNumberStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderedPhoneNumber' {Maybe OrderedPhoneNumberStatus
status :: Maybe OrderedPhoneNumberStatus
$sel:status:OrderedPhoneNumber' :: OrderedPhoneNumber -> Maybe OrderedPhoneNumberStatus
status} -> Maybe OrderedPhoneNumberStatus
status) (\s :: OrderedPhoneNumber
s@OrderedPhoneNumber' {} Maybe OrderedPhoneNumberStatus
a -> OrderedPhoneNumber
s {$sel:status:OrderedPhoneNumber' :: Maybe OrderedPhoneNumberStatus
status = Maybe OrderedPhoneNumberStatus
a} :: OrderedPhoneNumber)

-- | The phone number, in E.164 format.
orderedPhoneNumber_e164PhoneNumber :: Lens.Lens' OrderedPhoneNumber (Prelude.Maybe Prelude.Text)
orderedPhoneNumber_e164PhoneNumber :: (Maybe Text -> f (Maybe Text))
-> OrderedPhoneNumber -> f OrderedPhoneNumber
orderedPhoneNumber_e164PhoneNumber = (OrderedPhoneNumber -> Maybe (Sensitive Text))
-> (OrderedPhoneNumber
    -> Maybe (Sensitive Text) -> OrderedPhoneNumber)
-> Lens
     OrderedPhoneNumber
     OrderedPhoneNumber
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderedPhoneNumber' {Maybe (Sensitive Text)
e164PhoneNumber :: Maybe (Sensitive Text)
$sel:e164PhoneNumber:OrderedPhoneNumber' :: OrderedPhoneNumber -> Maybe (Sensitive Text)
e164PhoneNumber} -> Maybe (Sensitive Text)
e164PhoneNumber) (\s :: OrderedPhoneNumber
s@OrderedPhoneNumber' {} Maybe (Sensitive Text)
a -> OrderedPhoneNumber
s {$sel:e164PhoneNumber:OrderedPhoneNumber' :: Maybe (Sensitive Text)
e164PhoneNumber = Maybe (Sensitive Text)
a} :: OrderedPhoneNumber) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> OrderedPhoneNumber -> f OrderedPhoneNumber)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> OrderedPhoneNumber
-> f OrderedPhoneNumber
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

instance Core.FromJSON OrderedPhoneNumber where
  parseJSON :: Value -> Parser OrderedPhoneNumber
parseJSON =
    String
-> (Object -> Parser OrderedPhoneNumber)
-> Value
-> Parser OrderedPhoneNumber
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrderedPhoneNumber"
      ( \Object
x ->
          Maybe OrderedPhoneNumberStatus
-> Maybe (Sensitive Text) -> OrderedPhoneNumber
OrderedPhoneNumber'
            (Maybe OrderedPhoneNumberStatus
 -> Maybe (Sensitive Text) -> OrderedPhoneNumber)
-> Parser (Maybe OrderedPhoneNumberStatus)
-> Parser (Maybe (Sensitive Text) -> OrderedPhoneNumber)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OrderedPhoneNumberStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe (Sensitive Text) -> OrderedPhoneNumber)
-> Parser (Maybe (Sensitive Text)) -> Parser OrderedPhoneNumber
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"E164PhoneNumber")
      )

instance Prelude.Hashable OrderedPhoneNumber

instance Prelude.NFData OrderedPhoneNumber