{-# 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.Connect.Types.PhoneNumberStatus
-- 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.Connect.Types.PhoneNumberStatus where

import Amazonka.Connect.Types.PhoneNumberWorkflowStatus
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 status of the phone number.
--
-- -   @CLAIMED@ means the previous
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_ClaimedPhoneNumber.html ClaimedPhoneNumber>
--     or
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_UpdatePhoneNumber.html UpdatePhoneNumber>
--     operation succeeded.
--
-- -   @IN_PROGRESS@ means a
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_ClaimedPhoneNumber.html ClaimedPhoneNumber>
--     or
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_UpdatePhoneNumber.html UpdatePhoneNumber>
--     operation is still in progress and has not yet completed. You can
--     call
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribePhoneNumber.html DescribePhoneNumber>
--     at a later time to verify if the previous operation has completed.
--
-- -   @FAILED@ indicates that the previous
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_ClaimedPhoneNumber.html ClaimedPhoneNumber>
--     or
--     <https://docs.aws.amazon.com/connect/latest/APIReference/API_UpdatePhoneNumber.html UpdatePhoneNumber>
--     operation has failed. It will include a message indicating the
--     failure reason. A common reason for a failure may be that the
--     @TargetArn@ value you are claiming or updating a phone number to has
--     reached its limit of total claimed numbers. If you received a
--     @FAILED@ status from a @ClaimPhoneNumber@ API call, you have one day
--     to retry claiming the phone number before the number is released
--     back to the inventory for other customers to claim.
--
-- /See:/ 'newPhoneNumberStatus' smart constructor.
data PhoneNumberStatus = PhoneNumberStatus'
  { -- | The status message.
    PhoneNumberStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The status.
    PhoneNumberStatus -> Maybe PhoneNumberWorkflowStatus
status :: Prelude.Maybe PhoneNumberWorkflowStatus
  }
  deriving (PhoneNumberStatus -> PhoneNumberStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberStatus -> PhoneNumberStatus -> Bool
$c/= :: PhoneNumberStatus -> PhoneNumberStatus -> Bool
== :: PhoneNumberStatus -> PhoneNumberStatus -> Bool
$c== :: PhoneNumberStatus -> PhoneNumberStatus -> Bool
Prelude.Eq, ReadPrec [PhoneNumberStatus]
ReadPrec PhoneNumberStatus
Int -> ReadS PhoneNumberStatus
ReadS [PhoneNumberStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhoneNumberStatus]
$creadListPrec :: ReadPrec [PhoneNumberStatus]
readPrec :: ReadPrec PhoneNumberStatus
$creadPrec :: ReadPrec PhoneNumberStatus
readList :: ReadS [PhoneNumberStatus]
$creadList :: ReadS [PhoneNumberStatus]
readsPrec :: Int -> ReadS PhoneNumberStatus
$creadsPrec :: Int -> ReadS PhoneNumberStatus
Prelude.Read, Int -> PhoneNumberStatus -> ShowS
[PhoneNumberStatus] -> ShowS
PhoneNumberStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberStatus] -> ShowS
$cshowList :: [PhoneNumberStatus] -> ShowS
show :: PhoneNumberStatus -> String
$cshow :: PhoneNumberStatus -> String
showsPrec :: Int -> PhoneNumberStatus -> ShowS
$cshowsPrec :: Int -> PhoneNumberStatus -> ShowS
Prelude.Show, forall x. Rep PhoneNumberStatus x -> PhoneNumberStatus
forall x. PhoneNumberStatus -> Rep PhoneNumberStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberStatus x -> PhoneNumberStatus
$cfrom :: forall x. PhoneNumberStatus -> Rep PhoneNumberStatus x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumberStatus' 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:
--
-- 'message', 'phoneNumberStatus_message' - The status message.
--
-- 'status', 'phoneNumberStatus_status' - The status.
newPhoneNumberStatus ::
  PhoneNumberStatus
newPhoneNumberStatus :: PhoneNumberStatus
newPhoneNumberStatus =
  PhoneNumberStatus'
    { $sel:message:PhoneNumberStatus' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:status:PhoneNumberStatus' :: Maybe PhoneNumberWorkflowStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The status message.
phoneNumberStatus_message :: Lens.Lens' PhoneNumberStatus (Prelude.Maybe Prelude.Text)
phoneNumberStatus_message :: Lens' PhoneNumberStatus (Maybe Text)
phoneNumberStatus_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberStatus' {Maybe Text
message :: Maybe Text
$sel:message:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe Text
message} -> Maybe Text
message) (\s :: PhoneNumberStatus
s@PhoneNumberStatus' {} Maybe Text
a -> PhoneNumberStatus
s {$sel:message:PhoneNumberStatus' :: Maybe Text
message = Maybe Text
a} :: PhoneNumberStatus)

-- | The status.
phoneNumberStatus_status :: Lens.Lens' PhoneNumberStatus (Prelude.Maybe PhoneNumberWorkflowStatus)
phoneNumberStatus_status :: Lens' PhoneNumberStatus (Maybe PhoneNumberWorkflowStatus)
phoneNumberStatus_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberStatus' {Maybe PhoneNumberWorkflowStatus
status :: Maybe PhoneNumberWorkflowStatus
$sel:status:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe PhoneNumberWorkflowStatus
status} -> Maybe PhoneNumberWorkflowStatus
status) (\s :: PhoneNumberStatus
s@PhoneNumberStatus' {} Maybe PhoneNumberWorkflowStatus
a -> PhoneNumberStatus
s {$sel:status:PhoneNumberStatus' :: Maybe PhoneNumberWorkflowStatus
status = Maybe PhoneNumberWorkflowStatus
a} :: PhoneNumberStatus)

instance Data.FromJSON PhoneNumberStatus where
  parseJSON :: Value -> Parser PhoneNumberStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PhoneNumberStatus"
      ( \Object
x ->
          Maybe Text -> Maybe PhoneNumberWorkflowStatus -> PhoneNumberStatus
PhoneNumberStatus'
            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
"Message")
            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
"Status")
      )

instance Prelude.Hashable PhoneNumberStatus where
  hashWithSalt :: Int -> PhoneNumberStatus -> Int
hashWithSalt Int
_salt PhoneNumberStatus' {Maybe Text
Maybe PhoneNumberWorkflowStatus
status :: Maybe PhoneNumberWorkflowStatus
message :: Maybe Text
$sel:status:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe PhoneNumberWorkflowStatus
$sel:message:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PhoneNumberWorkflowStatus
status

instance Prelude.NFData PhoneNumberStatus where
  rnf :: PhoneNumberStatus -> ()
rnf PhoneNumberStatus' {Maybe Text
Maybe PhoneNumberWorkflowStatus
status :: Maybe PhoneNumberWorkflowStatus
message :: Maybe Text
$sel:status:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe PhoneNumberWorkflowStatus
$sel:message:PhoneNumberStatus' :: PhoneNumberStatus -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PhoneNumberWorkflowStatus
status