{-# 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.ChimeSdkVoice.Types.PhoneNumberCountry
-- 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.ChimeSdkVoice.Types.PhoneNumberCountry where

import Amazonka.ChimeSdkVoice.Types.PhoneNumberType
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

-- | /See:/ 'newPhoneNumberCountry' smart constructor.
data PhoneNumberCountry = PhoneNumberCountry'
  { PhoneNumberCountry -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
    PhoneNumberCountry -> Maybe [PhoneNumberType]
supportedPhoneNumberTypes :: Prelude.Maybe [PhoneNumberType]
  }
  deriving (PhoneNumberCountry -> PhoneNumberCountry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberCountry -> PhoneNumberCountry -> Bool
$c/= :: PhoneNumberCountry -> PhoneNumberCountry -> Bool
== :: PhoneNumberCountry -> PhoneNumberCountry -> Bool
$c== :: PhoneNumberCountry -> PhoneNumberCountry -> Bool
Prelude.Eq, ReadPrec [PhoneNumberCountry]
ReadPrec PhoneNumberCountry
Int -> ReadS PhoneNumberCountry
ReadS [PhoneNumberCountry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhoneNumberCountry]
$creadListPrec :: ReadPrec [PhoneNumberCountry]
readPrec :: ReadPrec PhoneNumberCountry
$creadPrec :: ReadPrec PhoneNumberCountry
readList :: ReadS [PhoneNumberCountry]
$creadList :: ReadS [PhoneNumberCountry]
readsPrec :: Int -> ReadS PhoneNumberCountry
$creadsPrec :: Int -> ReadS PhoneNumberCountry
Prelude.Read, Int -> PhoneNumberCountry -> ShowS
[PhoneNumberCountry] -> ShowS
PhoneNumberCountry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberCountry] -> ShowS
$cshowList :: [PhoneNumberCountry] -> ShowS
show :: PhoneNumberCountry -> String
$cshow :: PhoneNumberCountry -> String
showsPrec :: Int -> PhoneNumberCountry -> ShowS
$cshowsPrec :: Int -> PhoneNumberCountry -> ShowS
Prelude.Show, forall x. Rep PhoneNumberCountry x -> PhoneNumberCountry
forall x. PhoneNumberCountry -> Rep PhoneNumberCountry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberCountry x -> PhoneNumberCountry
$cfrom :: forall x. PhoneNumberCountry -> Rep PhoneNumberCountry x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumberCountry' 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:
--
-- 'countryCode', 'phoneNumberCountry_countryCode' - Undocumented member.
--
-- 'supportedPhoneNumberTypes', 'phoneNumberCountry_supportedPhoneNumberTypes' - Undocumented member.
newPhoneNumberCountry ::
  PhoneNumberCountry
newPhoneNumberCountry :: PhoneNumberCountry
newPhoneNumberCountry =
  PhoneNumberCountry'
    { $sel:countryCode:PhoneNumberCountry' :: Maybe Text
countryCode = forall a. Maybe a
Prelude.Nothing,
      $sel:supportedPhoneNumberTypes:PhoneNumberCountry' :: Maybe [PhoneNumberType]
supportedPhoneNumberTypes = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
phoneNumberCountry_countryCode :: Lens.Lens' PhoneNumberCountry (Prelude.Maybe Prelude.Text)
phoneNumberCountry_countryCode :: Lens' PhoneNumberCountry (Maybe Text)
phoneNumberCountry_countryCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberCountry' {Maybe Text
countryCode :: Maybe Text
$sel:countryCode:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe Text
countryCode} -> Maybe Text
countryCode) (\s :: PhoneNumberCountry
s@PhoneNumberCountry' {} Maybe Text
a -> PhoneNumberCountry
s {$sel:countryCode:PhoneNumberCountry' :: Maybe Text
countryCode = Maybe Text
a} :: PhoneNumberCountry)

-- | Undocumented member.
phoneNumberCountry_supportedPhoneNumberTypes :: Lens.Lens' PhoneNumberCountry (Prelude.Maybe [PhoneNumberType])
phoneNumberCountry_supportedPhoneNumberTypes :: Lens' PhoneNumberCountry (Maybe [PhoneNumberType])
phoneNumberCountry_supportedPhoneNumberTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberCountry' {Maybe [PhoneNumberType]
supportedPhoneNumberTypes :: Maybe [PhoneNumberType]
$sel:supportedPhoneNumberTypes:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe [PhoneNumberType]
supportedPhoneNumberTypes} -> Maybe [PhoneNumberType]
supportedPhoneNumberTypes) (\s :: PhoneNumberCountry
s@PhoneNumberCountry' {} Maybe [PhoneNumberType]
a -> PhoneNumberCountry
s {$sel:supportedPhoneNumberTypes:PhoneNumberCountry' :: Maybe [PhoneNumberType]
supportedPhoneNumberTypes = Maybe [PhoneNumberType]
a} :: PhoneNumberCountry) 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

instance Data.FromJSON PhoneNumberCountry where
  parseJSON :: Value -> Parser PhoneNumberCountry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PhoneNumberCountry"
      ( \Object
x ->
          Maybe Text -> Maybe [PhoneNumberType] -> PhoneNumberCountry
PhoneNumberCountry'
            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
"CountryCode")
            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
"SupportedPhoneNumberTypes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable PhoneNumberCountry where
  hashWithSalt :: Int -> PhoneNumberCountry -> Int
hashWithSalt Int
_salt PhoneNumberCountry' {Maybe [PhoneNumberType]
Maybe Text
supportedPhoneNumberTypes :: Maybe [PhoneNumberType]
countryCode :: Maybe Text
$sel:supportedPhoneNumberTypes:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe [PhoneNumberType]
$sel:countryCode:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
countryCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PhoneNumberType]
supportedPhoneNumberTypes

instance Prelude.NFData PhoneNumberCountry where
  rnf :: PhoneNumberCountry -> ()
rnf PhoneNumberCountry' {Maybe [PhoneNumberType]
Maybe Text
supportedPhoneNumberTypes :: Maybe [PhoneNumberType]
countryCode :: Maybe Text
$sel:supportedPhoneNumberTypes:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe [PhoneNumberType]
$sel:countryCode:PhoneNumberCountry' :: PhoneNumberCountry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
countryCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PhoneNumberType]
supportedPhoneNumberTypes