{-# 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.Pinpoint.Types.NumberValidateRequest
-- 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.Pinpoint.Types.NumberValidateRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies a phone number to validate and retrieve information about.
--
-- /See:/ 'newNumberValidateRequest' smart constructor.
data NumberValidateRequest = NumberValidateRequest'
  { -- | The two-character code, in ISO 3166-1 alpha-2 format, for the country or
    -- region where the phone number was originally registered.
    NumberValidateRequest -> Maybe Text
isoCountryCode :: Prelude.Maybe Prelude.Text,
    -- | The phone number to retrieve information about. The phone number that
    -- you provide should include a valid numeric country code. Otherwise, the
    -- operation might result in an error.
    NumberValidateRequest -> Maybe Text
phoneNumber :: Prelude.Maybe Prelude.Text
  }
  deriving (NumberValidateRequest -> NumberValidateRequest -> Bool
(NumberValidateRequest -> NumberValidateRequest -> Bool)
-> (NumberValidateRequest -> NumberValidateRequest -> Bool)
-> Eq NumberValidateRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NumberValidateRequest -> NumberValidateRequest -> Bool
$c/= :: NumberValidateRequest -> NumberValidateRequest -> Bool
== :: NumberValidateRequest -> NumberValidateRequest -> Bool
$c== :: NumberValidateRequest -> NumberValidateRequest -> Bool
Prelude.Eq, ReadPrec [NumberValidateRequest]
ReadPrec NumberValidateRequest
Int -> ReadS NumberValidateRequest
ReadS [NumberValidateRequest]
(Int -> ReadS NumberValidateRequest)
-> ReadS [NumberValidateRequest]
-> ReadPrec NumberValidateRequest
-> ReadPrec [NumberValidateRequest]
-> Read NumberValidateRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NumberValidateRequest]
$creadListPrec :: ReadPrec [NumberValidateRequest]
readPrec :: ReadPrec NumberValidateRequest
$creadPrec :: ReadPrec NumberValidateRequest
readList :: ReadS [NumberValidateRequest]
$creadList :: ReadS [NumberValidateRequest]
readsPrec :: Int -> ReadS NumberValidateRequest
$creadsPrec :: Int -> ReadS NumberValidateRequest
Prelude.Read, Int -> NumberValidateRequest -> ShowS
[NumberValidateRequest] -> ShowS
NumberValidateRequest -> String
(Int -> NumberValidateRequest -> ShowS)
-> (NumberValidateRequest -> String)
-> ([NumberValidateRequest] -> ShowS)
-> Show NumberValidateRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NumberValidateRequest] -> ShowS
$cshowList :: [NumberValidateRequest] -> ShowS
show :: NumberValidateRequest -> String
$cshow :: NumberValidateRequest -> String
showsPrec :: Int -> NumberValidateRequest -> ShowS
$cshowsPrec :: Int -> NumberValidateRequest -> ShowS
Prelude.Show, (forall x. NumberValidateRequest -> Rep NumberValidateRequest x)
-> (forall x. Rep NumberValidateRequest x -> NumberValidateRequest)
-> Generic NumberValidateRequest
forall x. Rep NumberValidateRequest x -> NumberValidateRequest
forall x. NumberValidateRequest -> Rep NumberValidateRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NumberValidateRequest x -> NumberValidateRequest
$cfrom :: forall x. NumberValidateRequest -> Rep NumberValidateRequest x
Prelude.Generic)

-- |
-- Create a value of 'NumberValidateRequest' 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:
--
-- 'isoCountryCode', 'numberValidateRequest_isoCountryCode' - The two-character code, in ISO 3166-1 alpha-2 format, for the country or
-- region where the phone number was originally registered.
--
-- 'phoneNumber', 'numberValidateRequest_phoneNumber' - The phone number to retrieve information about. The phone number that
-- you provide should include a valid numeric country code. Otherwise, the
-- operation might result in an error.
newNumberValidateRequest ::
  NumberValidateRequest
newNumberValidateRequest :: NumberValidateRequest
newNumberValidateRequest =
  NumberValidateRequest' :: Maybe Text -> Maybe Text -> NumberValidateRequest
NumberValidateRequest'
    { $sel:isoCountryCode:NumberValidateRequest' :: Maybe Text
isoCountryCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:NumberValidateRequest' :: Maybe Text
phoneNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The two-character code, in ISO 3166-1 alpha-2 format, for the country or
-- region where the phone number was originally registered.
numberValidateRequest_isoCountryCode :: Lens.Lens' NumberValidateRequest (Prelude.Maybe Prelude.Text)
numberValidateRequest_isoCountryCode :: (Maybe Text -> f (Maybe Text))
-> NumberValidateRequest -> f NumberValidateRequest
numberValidateRequest_isoCountryCode = (NumberValidateRequest -> Maybe Text)
-> (NumberValidateRequest -> Maybe Text -> NumberValidateRequest)
-> Lens
     NumberValidateRequest
     NumberValidateRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumberValidateRequest' {Maybe Text
isoCountryCode :: Maybe Text
$sel:isoCountryCode:NumberValidateRequest' :: NumberValidateRequest -> Maybe Text
isoCountryCode} -> Maybe Text
isoCountryCode) (\s :: NumberValidateRequest
s@NumberValidateRequest' {} Maybe Text
a -> NumberValidateRequest
s {$sel:isoCountryCode:NumberValidateRequest' :: Maybe Text
isoCountryCode = Maybe Text
a} :: NumberValidateRequest)

-- | The phone number to retrieve information about. The phone number that
-- you provide should include a valid numeric country code. Otherwise, the
-- operation might result in an error.
numberValidateRequest_phoneNumber :: Lens.Lens' NumberValidateRequest (Prelude.Maybe Prelude.Text)
numberValidateRequest_phoneNumber :: (Maybe Text -> f (Maybe Text))
-> NumberValidateRequest -> f NumberValidateRequest
numberValidateRequest_phoneNumber = (NumberValidateRequest -> Maybe Text)
-> (NumberValidateRequest -> Maybe Text -> NumberValidateRequest)
-> Lens
     NumberValidateRequest
     NumberValidateRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumberValidateRequest' {Maybe Text
phoneNumber :: Maybe Text
$sel:phoneNumber:NumberValidateRequest' :: NumberValidateRequest -> Maybe Text
phoneNumber} -> Maybe Text
phoneNumber) (\s :: NumberValidateRequest
s@NumberValidateRequest' {} Maybe Text
a -> NumberValidateRequest
s {$sel:phoneNumber:NumberValidateRequest' :: Maybe Text
phoneNumber = Maybe Text
a} :: NumberValidateRequest)

instance Prelude.Hashable NumberValidateRequest

instance Prelude.NFData NumberValidateRequest

instance Core.ToJSON NumberValidateRequest where
  toJSON :: NumberValidateRequest -> Value
toJSON NumberValidateRequest' {Maybe Text
phoneNumber :: Maybe Text
isoCountryCode :: Maybe Text
$sel:phoneNumber:NumberValidateRequest' :: NumberValidateRequest -> Maybe Text
$sel:isoCountryCode:NumberValidateRequest' :: NumberValidateRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IsoCountryCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
isoCountryCode,
            (Text
"PhoneNumber" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
phoneNumber
          ]
      )