{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ListSupportedPhoneNumberCountries
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists supported phone number countries.
module Amazonka.Chime.ListSupportedPhoneNumberCountries
  ( -- * Creating a Request
    ListSupportedPhoneNumberCountries (..),
    newListSupportedPhoneNumberCountries,

    -- * Request Lenses
    listSupportedPhoneNumberCountries_productType,

    -- * Destructuring the Response
    ListSupportedPhoneNumberCountriesResponse (..),
    newListSupportedPhoneNumberCountriesResponse,

    -- * Response Lenses
    listSupportedPhoneNumberCountriesResponse_phoneNumberCountries,
    listSupportedPhoneNumberCountriesResponse_httpStatus,
  )
where

import Amazonka.Chime.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListSupportedPhoneNumberCountries' smart constructor.
data ListSupportedPhoneNumberCountries = ListSupportedPhoneNumberCountries'
  { -- | The phone number product type.
    ListSupportedPhoneNumberCountries -> PhoneNumberProductType
productType :: PhoneNumberProductType
  }
  deriving (ListSupportedPhoneNumberCountries
-> ListSupportedPhoneNumberCountries -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSupportedPhoneNumberCountries
-> ListSupportedPhoneNumberCountries -> Bool
$c/= :: ListSupportedPhoneNumberCountries
-> ListSupportedPhoneNumberCountries -> Bool
== :: ListSupportedPhoneNumberCountries
-> ListSupportedPhoneNumberCountries -> Bool
$c== :: ListSupportedPhoneNumberCountries
-> ListSupportedPhoneNumberCountries -> Bool
Prelude.Eq, ReadPrec [ListSupportedPhoneNumberCountries]
ReadPrec ListSupportedPhoneNumberCountries
Int -> ReadS ListSupportedPhoneNumberCountries
ReadS [ListSupportedPhoneNumberCountries]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSupportedPhoneNumberCountries]
$creadListPrec :: ReadPrec [ListSupportedPhoneNumberCountries]
readPrec :: ReadPrec ListSupportedPhoneNumberCountries
$creadPrec :: ReadPrec ListSupportedPhoneNumberCountries
readList :: ReadS [ListSupportedPhoneNumberCountries]
$creadList :: ReadS [ListSupportedPhoneNumberCountries]
readsPrec :: Int -> ReadS ListSupportedPhoneNumberCountries
$creadsPrec :: Int -> ReadS ListSupportedPhoneNumberCountries
Prelude.Read, Int -> ListSupportedPhoneNumberCountries -> ShowS
[ListSupportedPhoneNumberCountries] -> ShowS
ListSupportedPhoneNumberCountries -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSupportedPhoneNumberCountries] -> ShowS
$cshowList :: [ListSupportedPhoneNumberCountries] -> ShowS
show :: ListSupportedPhoneNumberCountries -> String
$cshow :: ListSupportedPhoneNumberCountries -> String
showsPrec :: Int -> ListSupportedPhoneNumberCountries -> ShowS
$cshowsPrec :: Int -> ListSupportedPhoneNumberCountries -> ShowS
Prelude.Show, forall x.
Rep ListSupportedPhoneNumberCountries x
-> ListSupportedPhoneNumberCountries
forall x.
ListSupportedPhoneNumberCountries
-> Rep ListSupportedPhoneNumberCountries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSupportedPhoneNumberCountries x
-> ListSupportedPhoneNumberCountries
$cfrom :: forall x.
ListSupportedPhoneNumberCountries
-> Rep ListSupportedPhoneNumberCountries x
Prelude.Generic)

-- |
-- Create a value of 'ListSupportedPhoneNumberCountries' 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', 'listSupportedPhoneNumberCountries_productType' - The phone number product type.
newListSupportedPhoneNumberCountries ::
  -- | 'productType'
  PhoneNumberProductType ->
  ListSupportedPhoneNumberCountries
newListSupportedPhoneNumberCountries :: PhoneNumberProductType -> ListSupportedPhoneNumberCountries
newListSupportedPhoneNumberCountries PhoneNumberProductType
pProductType_ =
  ListSupportedPhoneNumberCountries'
    { $sel:productType:ListSupportedPhoneNumberCountries' :: PhoneNumberProductType
productType =
        PhoneNumberProductType
pProductType_
    }

-- | The phone number product type.
listSupportedPhoneNumberCountries_productType :: Lens.Lens' ListSupportedPhoneNumberCountries PhoneNumberProductType
listSupportedPhoneNumberCountries_productType :: Lens' ListSupportedPhoneNumberCountries PhoneNumberProductType
listSupportedPhoneNumberCountries_productType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSupportedPhoneNumberCountries' {PhoneNumberProductType
productType :: PhoneNumberProductType
$sel:productType:ListSupportedPhoneNumberCountries' :: ListSupportedPhoneNumberCountries -> PhoneNumberProductType
productType} -> PhoneNumberProductType
productType) (\s :: ListSupportedPhoneNumberCountries
s@ListSupportedPhoneNumberCountries' {} PhoneNumberProductType
a -> ListSupportedPhoneNumberCountries
s {$sel:productType:ListSupportedPhoneNumberCountries' :: PhoneNumberProductType
productType = PhoneNumberProductType
a} :: ListSupportedPhoneNumberCountries)

instance
  Core.AWSRequest
    ListSupportedPhoneNumberCountries
  where
  type
    AWSResponse ListSupportedPhoneNumberCountries =
      ListSupportedPhoneNumberCountriesResponse
  request :: (Service -> Service)
-> ListSupportedPhoneNumberCountries
-> Request ListSupportedPhoneNumberCountries
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListSupportedPhoneNumberCountries
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListSupportedPhoneNumberCountries)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [PhoneNumberCountry]
-> Int -> ListSupportedPhoneNumberCountriesResponse
ListSupportedPhoneNumberCountriesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PhoneNumberCountries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ListSupportedPhoneNumberCountries
  where
  hashWithSalt :: Int -> ListSupportedPhoneNumberCountries -> Int
hashWithSalt
    Int
_salt
    ListSupportedPhoneNumberCountries' {PhoneNumberProductType
productType :: PhoneNumberProductType
$sel:productType:ListSupportedPhoneNumberCountries' :: ListSupportedPhoneNumberCountries -> PhoneNumberProductType
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PhoneNumberProductType
productType

instance
  Prelude.NFData
    ListSupportedPhoneNumberCountries
  where
  rnf :: ListSupportedPhoneNumberCountries -> ()
rnf ListSupportedPhoneNumberCountries' {PhoneNumberProductType
productType :: PhoneNumberProductType
$sel:productType:ListSupportedPhoneNumberCountries' :: ListSupportedPhoneNumberCountries -> PhoneNumberProductType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf PhoneNumberProductType
productType

instance
  Data.ToHeaders
    ListSupportedPhoneNumberCountries
  where
  toHeaders :: ListSupportedPhoneNumberCountries -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance
  Data.ToPath
    ListSupportedPhoneNumberCountries
  where
  toPath :: ListSupportedPhoneNumberCountries -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/phone-number-countries"

instance
  Data.ToQuery
    ListSupportedPhoneNumberCountries
  where
  toQuery :: ListSupportedPhoneNumberCountries -> QueryString
toQuery ListSupportedPhoneNumberCountries' {PhoneNumberProductType
productType :: PhoneNumberProductType
$sel:productType:ListSupportedPhoneNumberCountries' :: ListSupportedPhoneNumberCountries -> PhoneNumberProductType
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"product-type" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: PhoneNumberProductType
productType]

-- | /See:/ 'newListSupportedPhoneNumberCountriesResponse' smart constructor.
data ListSupportedPhoneNumberCountriesResponse = ListSupportedPhoneNumberCountriesResponse'
  { -- | The supported phone number countries.
    ListSupportedPhoneNumberCountriesResponse
-> Maybe [PhoneNumberCountry]
phoneNumberCountries :: Prelude.Maybe [PhoneNumberCountry],
    -- | The response's http status code.
    ListSupportedPhoneNumberCountriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSupportedPhoneNumberCountriesResponse
-> ListSupportedPhoneNumberCountriesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSupportedPhoneNumberCountriesResponse
-> ListSupportedPhoneNumberCountriesResponse -> Bool
$c/= :: ListSupportedPhoneNumberCountriesResponse
-> ListSupportedPhoneNumberCountriesResponse -> Bool
== :: ListSupportedPhoneNumberCountriesResponse
-> ListSupportedPhoneNumberCountriesResponse -> Bool
$c== :: ListSupportedPhoneNumberCountriesResponse
-> ListSupportedPhoneNumberCountriesResponse -> Bool
Prelude.Eq, ReadPrec [ListSupportedPhoneNumberCountriesResponse]
ReadPrec ListSupportedPhoneNumberCountriesResponse
Int -> ReadS ListSupportedPhoneNumberCountriesResponse
ReadS [ListSupportedPhoneNumberCountriesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSupportedPhoneNumberCountriesResponse]
$creadListPrec :: ReadPrec [ListSupportedPhoneNumberCountriesResponse]
readPrec :: ReadPrec ListSupportedPhoneNumberCountriesResponse
$creadPrec :: ReadPrec ListSupportedPhoneNumberCountriesResponse
readList :: ReadS [ListSupportedPhoneNumberCountriesResponse]
$creadList :: ReadS [ListSupportedPhoneNumberCountriesResponse]
readsPrec :: Int -> ReadS ListSupportedPhoneNumberCountriesResponse
$creadsPrec :: Int -> ReadS ListSupportedPhoneNumberCountriesResponse
Prelude.Read, Int -> ListSupportedPhoneNumberCountriesResponse -> ShowS
[ListSupportedPhoneNumberCountriesResponse] -> ShowS
ListSupportedPhoneNumberCountriesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSupportedPhoneNumberCountriesResponse] -> ShowS
$cshowList :: [ListSupportedPhoneNumberCountriesResponse] -> ShowS
show :: ListSupportedPhoneNumberCountriesResponse -> String
$cshow :: ListSupportedPhoneNumberCountriesResponse -> String
showsPrec :: Int -> ListSupportedPhoneNumberCountriesResponse -> ShowS
$cshowsPrec :: Int -> ListSupportedPhoneNumberCountriesResponse -> ShowS
Prelude.Show, forall x.
Rep ListSupportedPhoneNumberCountriesResponse x
-> ListSupportedPhoneNumberCountriesResponse
forall x.
ListSupportedPhoneNumberCountriesResponse
-> Rep ListSupportedPhoneNumberCountriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSupportedPhoneNumberCountriesResponse x
-> ListSupportedPhoneNumberCountriesResponse
$cfrom :: forall x.
ListSupportedPhoneNumberCountriesResponse
-> Rep ListSupportedPhoneNumberCountriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSupportedPhoneNumberCountriesResponse' 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:
--
-- 'phoneNumberCountries', 'listSupportedPhoneNumberCountriesResponse_phoneNumberCountries' - The supported phone number countries.
--
-- 'httpStatus', 'listSupportedPhoneNumberCountriesResponse_httpStatus' - The response's http status code.
newListSupportedPhoneNumberCountriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSupportedPhoneNumberCountriesResponse
newListSupportedPhoneNumberCountriesResponse :: Int -> ListSupportedPhoneNumberCountriesResponse
newListSupportedPhoneNumberCountriesResponse
  Int
pHttpStatus_ =
    ListSupportedPhoneNumberCountriesResponse'
      { $sel:phoneNumberCountries:ListSupportedPhoneNumberCountriesResponse' :: Maybe [PhoneNumberCountry]
phoneNumberCountries =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListSupportedPhoneNumberCountriesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The supported phone number countries.
listSupportedPhoneNumberCountriesResponse_phoneNumberCountries :: Lens.Lens' ListSupportedPhoneNumberCountriesResponse (Prelude.Maybe [PhoneNumberCountry])
listSupportedPhoneNumberCountriesResponse_phoneNumberCountries :: Lens'
  ListSupportedPhoneNumberCountriesResponse
  (Maybe [PhoneNumberCountry])
listSupportedPhoneNumberCountriesResponse_phoneNumberCountries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSupportedPhoneNumberCountriesResponse' {Maybe [PhoneNumberCountry]
phoneNumberCountries :: Maybe [PhoneNumberCountry]
$sel:phoneNumberCountries:ListSupportedPhoneNumberCountriesResponse' :: ListSupportedPhoneNumberCountriesResponse
-> Maybe [PhoneNumberCountry]
phoneNumberCountries} -> Maybe [PhoneNumberCountry]
phoneNumberCountries) (\s :: ListSupportedPhoneNumberCountriesResponse
s@ListSupportedPhoneNumberCountriesResponse' {} Maybe [PhoneNumberCountry]
a -> ListSupportedPhoneNumberCountriesResponse
s {$sel:phoneNumberCountries:ListSupportedPhoneNumberCountriesResponse' :: Maybe [PhoneNumberCountry]
phoneNumberCountries = Maybe [PhoneNumberCountry]
a} :: ListSupportedPhoneNumberCountriesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listSupportedPhoneNumberCountriesResponse_httpStatus :: Lens.Lens' ListSupportedPhoneNumberCountriesResponse Prelude.Int
listSupportedPhoneNumberCountriesResponse_httpStatus :: Lens' ListSupportedPhoneNumberCountriesResponse Int
listSupportedPhoneNumberCountriesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSupportedPhoneNumberCountriesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSupportedPhoneNumberCountriesResponse' :: ListSupportedPhoneNumberCountriesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSupportedPhoneNumberCountriesResponse
s@ListSupportedPhoneNumberCountriesResponse' {} Int
a -> ListSupportedPhoneNumberCountriesResponse
s {$sel:httpStatus:ListSupportedPhoneNumberCountriesResponse' :: Int
httpStatus = Int
a} :: ListSupportedPhoneNumberCountriesResponse)

instance
  Prelude.NFData
    ListSupportedPhoneNumberCountriesResponse
  where
  rnf :: ListSupportedPhoneNumberCountriesResponse -> ()
rnf ListSupportedPhoneNumberCountriesResponse' {Int
Maybe [PhoneNumberCountry]
httpStatus :: Int
phoneNumberCountries :: Maybe [PhoneNumberCountry]
$sel:httpStatus:ListSupportedPhoneNumberCountriesResponse' :: ListSupportedPhoneNumberCountriesResponse -> Int
$sel:phoneNumberCountries:ListSupportedPhoneNumberCountriesResponse' :: ListSupportedPhoneNumberCountriesResponse
-> Maybe [PhoneNumberCountry]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [PhoneNumberCountry]
phoneNumberCountries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus