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

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

-- | The details of a phone number order created for Amazon Chime.
--
-- /See:/ 'newPhoneNumberOrder' smart constructor.
data PhoneNumberOrder = PhoneNumberOrder'
  { -- | The status of the phone number order.
    PhoneNumberOrder -> Maybe PhoneNumberOrderStatus
status :: Prelude.Maybe PhoneNumberOrderStatus,
    -- | The ordered phone number details, such as the phone number in E.164
    -- format and the phone number status.
    PhoneNumberOrder -> Maybe [OrderedPhoneNumber]
orderedPhoneNumbers :: Prelude.Maybe [OrderedPhoneNumber],
    -- | The updated phone number order time stamp, in ISO 8601 format.
    PhoneNumberOrder -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The phone number order product type.
    PhoneNumberOrder -> Maybe PhoneNumberProductType
productType :: Prelude.Maybe PhoneNumberProductType,
    -- | The phone number order ID.
    PhoneNumberOrder -> Maybe Text
phoneNumberOrderId :: Prelude.Maybe Prelude.Text,
    -- | The phone number order creation time stamp, in ISO 8601 format.
    PhoneNumberOrder -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (PhoneNumberOrder -> PhoneNumberOrder -> Bool
(PhoneNumberOrder -> PhoneNumberOrder -> Bool)
-> (PhoneNumberOrder -> PhoneNumberOrder -> Bool)
-> Eq PhoneNumberOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberOrder -> PhoneNumberOrder -> Bool
$c/= :: PhoneNumberOrder -> PhoneNumberOrder -> Bool
== :: PhoneNumberOrder -> PhoneNumberOrder -> Bool
$c== :: PhoneNumberOrder -> PhoneNumberOrder -> Bool
Prelude.Eq, Int -> PhoneNumberOrder -> ShowS
[PhoneNumberOrder] -> ShowS
PhoneNumberOrder -> String
(Int -> PhoneNumberOrder -> ShowS)
-> (PhoneNumberOrder -> String)
-> ([PhoneNumberOrder] -> ShowS)
-> Show PhoneNumberOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberOrder] -> ShowS
$cshowList :: [PhoneNumberOrder] -> ShowS
show :: PhoneNumberOrder -> String
$cshow :: PhoneNumberOrder -> String
showsPrec :: Int -> PhoneNumberOrder -> ShowS
$cshowsPrec :: Int -> PhoneNumberOrder -> ShowS
Prelude.Show, (forall x. PhoneNumberOrder -> Rep PhoneNumberOrder x)
-> (forall x. Rep PhoneNumberOrder x -> PhoneNumberOrder)
-> Generic PhoneNumberOrder
forall x. Rep PhoneNumberOrder x -> PhoneNumberOrder
forall x. PhoneNumberOrder -> Rep PhoneNumberOrder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberOrder x -> PhoneNumberOrder
$cfrom :: forall x. PhoneNumberOrder -> Rep PhoneNumberOrder x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumberOrder' 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', 'phoneNumberOrder_status' - The status of the phone number order.
--
-- 'orderedPhoneNumbers', 'phoneNumberOrder_orderedPhoneNumbers' - The ordered phone number details, such as the phone number in E.164
-- format and the phone number status.
--
-- 'updatedTimestamp', 'phoneNumberOrder_updatedTimestamp' - The updated phone number order time stamp, in ISO 8601 format.
--
-- 'productType', 'phoneNumberOrder_productType' - The phone number order product type.
--
-- 'phoneNumberOrderId', 'phoneNumberOrder_phoneNumberOrderId' - The phone number order ID.
--
-- 'createdTimestamp', 'phoneNumberOrder_createdTimestamp' - The phone number order creation time stamp, in ISO 8601 format.
newPhoneNumberOrder ::
  PhoneNumberOrder
newPhoneNumberOrder :: PhoneNumberOrder
newPhoneNumberOrder =
  PhoneNumberOrder' :: Maybe PhoneNumberOrderStatus
-> Maybe [OrderedPhoneNumber]
-> Maybe POSIX
-> Maybe PhoneNumberProductType
-> Maybe Text
-> Maybe POSIX
-> PhoneNumberOrder
PhoneNumberOrder'
    { $sel:status:PhoneNumberOrder' :: Maybe PhoneNumberOrderStatus
status = Maybe PhoneNumberOrderStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:orderedPhoneNumbers:PhoneNumberOrder' :: Maybe [OrderedPhoneNumber]
orderedPhoneNumbers = Maybe [OrderedPhoneNumber]
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedTimestamp:PhoneNumberOrder' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:productType:PhoneNumberOrder' :: Maybe PhoneNumberProductType
productType = Maybe PhoneNumberProductType
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberOrderId:PhoneNumberOrder' :: Maybe Text
phoneNumberOrderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:PhoneNumberOrder' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the phone number order.
phoneNumberOrder_status :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe PhoneNumberOrderStatus)
phoneNumberOrder_status :: (Maybe PhoneNumberOrderStatus -> f (Maybe PhoneNumberOrderStatus))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_status = (PhoneNumberOrder -> Maybe PhoneNumberOrderStatus)
-> (PhoneNumberOrder
    -> Maybe PhoneNumberOrderStatus -> PhoneNumberOrder)
-> Lens
     PhoneNumberOrder
     PhoneNumberOrder
     (Maybe PhoneNumberOrderStatus)
     (Maybe PhoneNumberOrderStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe PhoneNumberOrderStatus
status :: Maybe PhoneNumberOrderStatus
$sel:status:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe PhoneNumberOrderStatus
status} -> Maybe PhoneNumberOrderStatus
status) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe PhoneNumberOrderStatus
a -> PhoneNumberOrder
s {$sel:status:PhoneNumberOrder' :: Maybe PhoneNumberOrderStatus
status = Maybe PhoneNumberOrderStatus
a} :: PhoneNumberOrder)

-- | The ordered phone number details, such as the phone number in E.164
-- format and the phone number status.
phoneNumberOrder_orderedPhoneNumbers :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe [OrderedPhoneNumber])
phoneNumberOrder_orderedPhoneNumbers :: (Maybe [OrderedPhoneNumber] -> f (Maybe [OrderedPhoneNumber]))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_orderedPhoneNumbers = (PhoneNumberOrder -> Maybe [OrderedPhoneNumber])
-> (PhoneNumberOrder
    -> Maybe [OrderedPhoneNumber] -> PhoneNumberOrder)
-> Lens
     PhoneNumberOrder
     PhoneNumberOrder
     (Maybe [OrderedPhoneNumber])
     (Maybe [OrderedPhoneNumber])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe [OrderedPhoneNumber]
orderedPhoneNumbers :: Maybe [OrderedPhoneNumber]
$sel:orderedPhoneNumbers:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe [OrderedPhoneNumber]
orderedPhoneNumbers} -> Maybe [OrderedPhoneNumber]
orderedPhoneNumbers) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe [OrderedPhoneNumber]
a -> PhoneNumberOrder
s {$sel:orderedPhoneNumbers:PhoneNumberOrder' :: Maybe [OrderedPhoneNumber]
orderedPhoneNumbers = Maybe [OrderedPhoneNumber]
a} :: PhoneNumberOrder) ((Maybe [OrderedPhoneNumber] -> f (Maybe [OrderedPhoneNumber]))
 -> PhoneNumberOrder -> f PhoneNumberOrder)
-> ((Maybe [OrderedPhoneNumber] -> f (Maybe [OrderedPhoneNumber]))
    -> Maybe [OrderedPhoneNumber] -> f (Maybe [OrderedPhoneNumber]))
-> (Maybe [OrderedPhoneNumber] -> f (Maybe [OrderedPhoneNumber]))
-> PhoneNumberOrder
-> f PhoneNumberOrder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
-> Iso
     (Maybe [OrderedPhoneNumber])
     (Maybe [OrderedPhoneNumber])
     (Maybe [OrderedPhoneNumber])
     (Maybe [OrderedPhoneNumber])
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
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
  [OrderedPhoneNumber]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The updated phone number order time stamp, in ISO 8601 format.
phoneNumberOrder_updatedTimestamp :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe Prelude.UTCTime)
phoneNumberOrder_updatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_updatedTimestamp = (PhoneNumberOrder -> Maybe POSIX)
-> (PhoneNumberOrder -> Maybe POSIX -> PhoneNumberOrder)
-> Lens
     PhoneNumberOrder PhoneNumberOrder (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe POSIX
a -> PhoneNumberOrder
s {$sel:updatedTimestamp:PhoneNumberOrder' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: PhoneNumberOrder) ((Maybe POSIX -> f (Maybe POSIX))
 -> PhoneNumberOrder -> f PhoneNumberOrder)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberOrder
-> f PhoneNumberOrder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The phone number order product type.
phoneNumberOrder_productType :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe PhoneNumberProductType)
phoneNumberOrder_productType :: (Maybe PhoneNumberProductType -> f (Maybe PhoneNumberProductType))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_productType = (PhoneNumberOrder -> Maybe PhoneNumberProductType)
-> (PhoneNumberOrder
    -> Maybe PhoneNumberProductType -> PhoneNumberOrder)
-> Lens
     PhoneNumberOrder
     PhoneNumberOrder
     (Maybe PhoneNumberProductType)
     (Maybe PhoneNumberProductType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe PhoneNumberProductType
productType :: Maybe PhoneNumberProductType
$sel:productType:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe PhoneNumberProductType
productType} -> Maybe PhoneNumberProductType
productType) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe PhoneNumberProductType
a -> PhoneNumberOrder
s {$sel:productType:PhoneNumberOrder' :: Maybe PhoneNumberProductType
productType = Maybe PhoneNumberProductType
a} :: PhoneNumberOrder)

-- | The phone number order ID.
phoneNumberOrder_phoneNumberOrderId :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe Prelude.Text)
phoneNumberOrder_phoneNumberOrderId :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_phoneNumberOrderId = (PhoneNumberOrder -> Maybe Text)
-> (PhoneNumberOrder -> Maybe Text -> PhoneNumberOrder)
-> Lens PhoneNumberOrder PhoneNumberOrder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe Text
phoneNumberOrderId :: Maybe Text
$sel:phoneNumberOrderId:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe Text
phoneNumberOrderId} -> Maybe Text
phoneNumberOrderId) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe Text
a -> PhoneNumberOrder
s {$sel:phoneNumberOrderId:PhoneNumberOrder' :: Maybe Text
phoneNumberOrderId = Maybe Text
a} :: PhoneNumberOrder)

-- | The phone number order creation time stamp, in ISO 8601 format.
phoneNumberOrder_createdTimestamp :: Lens.Lens' PhoneNumberOrder (Prelude.Maybe Prelude.UTCTime)
phoneNumberOrder_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberOrder -> f PhoneNumberOrder
phoneNumberOrder_createdTimestamp = (PhoneNumberOrder -> Maybe POSIX)
-> (PhoneNumberOrder -> Maybe POSIX -> PhoneNumberOrder)
-> Lens
     PhoneNumberOrder PhoneNumberOrder (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberOrder' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:PhoneNumberOrder' :: PhoneNumberOrder -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: PhoneNumberOrder
s@PhoneNumberOrder' {} Maybe POSIX
a -> PhoneNumberOrder
s {$sel:createdTimestamp:PhoneNumberOrder' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: PhoneNumberOrder) ((Maybe POSIX -> f (Maybe POSIX))
 -> PhoneNumberOrder -> f PhoneNumberOrder)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberOrder
-> f PhoneNumberOrder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON PhoneNumberOrder where
  parseJSON :: Value -> Parser PhoneNumberOrder
parseJSON =
    String
-> (Object -> Parser PhoneNumberOrder)
-> Value
-> Parser PhoneNumberOrder
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PhoneNumberOrder"
      ( \Object
x ->
          Maybe PhoneNumberOrderStatus
-> Maybe [OrderedPhoneNumber]
-> Maybe POSIX
-> Maybe PhoneNumberProductType
-> Maybe Text
-> Maybe POSIX
-> PhoneNumberOrder
PhoneNumberOrder'
            (Maybe PhoneNumberOrderStatus
 -> Maybe [OrderedPhoneNumber]
 -> Maybe POSIX
 -> Maybe PhoneNumberProductType
 -> Maybe Text
 -> Maybe POSIX
 -> PhoneNumberOrder)
-> Parser (Maybe PhoneNumberOrderStatus)
-> Parser
     (Maybe [OrderedPhoneNumber]
      -> Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe Text
      -> Maybe POSIX
      -> PhoneNumberOrder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PhoneNumberOrderStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe [OrderedPhoneNumber]
   -> Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe Text
   -> Maybe POSIX
   -> PhoneNumberOrder)
-> Parser (Maybe [OrderedPhoneNumber])
-> Parser
     (Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe Text
      -> Maybe POSIX
      -> PhoneNumberOrder)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [OrderedPhoneNumber]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OrderedPhoneNumbers"
                            Parser (Maybe (Maybe [OrderedPhoneNumber]))
-> Maybe [OrderedPhoneNumber]
-> Parser (Maybe [OrderedPhoneNumber])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OrderedPhoneNumber]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe Text
   -> Maybe POSIX
   -> PhoneNumberOrder)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PhoneNumberProductType
      -> Maybe Text -> Maybe POSIX -> PhoneNumberOrder)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedTimestamp")
            Parser
  (Maybe PhoneNumberProductType
   -> Maybe Text -> Maybe POSIX -> PhoneNumberOrder)
-> Parser (Maybe PhoneNumberProductType)
-> Parser (Maybe Text -> Maybe POSIX -> PhoneNumberOrder)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PhoneNumberProductType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProductType")
            Parser (Maybe Text -> Maybe POSIX -> PhoneNumberOrder)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> PhoneNumberOrder)
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
"PhoneNumberOrderId")
            Parser (Maybe POSIX -> PhoneNumberOrder)
-> Parser (Maybe POSIX) -> Parser PhoneNumberOrder
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTimestamp")
      )

instance Prelude.Hashable PhoneNumberOrder

instance Prelude.NFData PhoneNumberOrder