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

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

-- | The country and area code for a proxy phone number in a proxy phone
-- session.
--
-- /See:/ 'newGeoMatchParams' smart constructor.
data GeoMatchParams = GeoMatchParams'
  { -- | The country.
    GeoMatchParams -> Text
country :: Prelude.Text,
    -- | The area code.
    GeoMatchParams -> Text
areaCode :: Prelude.Text
  }
  deriving (GeoMatchParams -> GeoMatchParams -> Bool
(GeoMatchParams -> GeoMatchParams -> Bool)
-> (GeoMatchParams -> GeoMatchParams -> Bool) -> Eq GeoMatchParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoMatchParams -> GeoMatchParams -> Bool
$c/= :: GeoMatchParams -> GeoMatchParams -> Bool
== :: GeoMatchParams -> GeoMatchParams -> Bool
$c== :: GeoMatchParams -> GeoMatchParams -> Bool
Prelude.Eq, ReadPrec [GeoMatchParams]
ReadPrec GeoMatchParams
Int -> ReadS GeoMatchParams
ReadS [GeoMatchParams]
(Int -> ReadS GeoMatchParams)
-> ReadS [GeoMatchParams]
-> ReadPrec GeoMatchParams
-> ReadPrec [GeoMatchParams]
-> Read GeoMatchParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoMatchParams]
$creadListPrec :: ReadPrec [GeoMatchParams]
readPrec :: ReadPrec GeoMatchParams
$creadPrec :: ReadPrec GeoMatchParams
readList :: ReadS [GeoMatchParams]
$creadList :: ReadS [GeoMatchParams]
readsPrec :: Int -> ReadS GeoMatchParams
$creadsPrec :: Int -> ReadS GeoMatchParams
Prelude.Read, Int -> GeoMatchParams -> ShowS
[GeoMatchParams] -> ShowS
GeoMatchParams -> String
(Int -> GeoMatchParams -> ShowS)
-> (GeoMatchParams -> String)
-> ([GeoMatchParams] -> ShowS)
-> Show GeoMatchParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoMatchParams] -> ShowS
$cshowList :: [GeoMatchParams] -> ShowS
show :: GeoMatchParams -> String
$cshow :: GeoMatchParams -> String
showsPrec :: Int -> GeoMatchParams -> ShowS
$cshowsPrec :: Int -> GeoMatchParams -> ShowS
Prelude.Show, (forall x. GeoMatchParams -> Rep GeoMatchParams x)
-> (forall x. Rep GeoMatchParams x -> GeoMatchParams)
-> Generic GeoMatchParams
forall x. Rep GeoMatchParams x -> GeoMatchParams
forall x. GeoMatchParams -> Rep GeoMatchParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoMatchParams x -> GeoMatchParams
$cfrom :: forall x. GeoMatchParams -> Rep GeoMatchParams x
Prelude.Generic)

-- |
-- Create a value of 'GeoMatchParams' 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:
--
-- 'country', 'geoMatchParams_country' - The country.
--
-- 'areaCode', 'geoMatchParams_areaCode' - The area code.
newGeoMatchParams ::
  -- | 'country'
  Prelude.Text ->
  -- | 'areaCode'
  Prelude.Text ->
  GeoMatchParams
newGeoMatchParams :: Text -> Text -> GeoMatchParams
newGeoMatchParams Text
pCountry_ Text
pAreaCode_ =
  GeoMatchParams' :: Text -> Text -> GeoMatchParams
GeoMatchParams'
    { $sel:country:GeoMatchParams' :: Text
country = Text
pCountry_,
      $sel:areaCode:GeoMatchParams' :: Text
areaCode = Text
pAreaCode_
    }

-- | The country.
geoMatchParams_country :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_country :: (Text -> f Text) -> GeoMatchParams -> f GeoMatchParams
geoMatchParams_country = (GeoMatchParams -> Text)
-> (GeoMatchParams -> Text -> GeoMatchParams)
-> Lens GeoMatchParams GeoMatchParams Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchParams' {Text
country :: Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
country} -> Text
country) (\s :: GeoMatchParams
s@GeoMatchParams' {} Text
a -> GeoMatchParams
s {$sel:country:GeoMatchParams' :: Text
country = Text
a} :: GeoMatchParams)

-- | The area code.
geoMatchParams_areaCode :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_areaCode :: (Text -> f Text) -> GeoMatchParams -> f GeoMatchParams
geoMatchParams_areaCode = (GeoMatchParams -> Text)
-> (GeoMatchParams -> Text -> GeoMatchParams)
-> Lens GeoMatchParams GeoMatchParams Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchParams' {Text
areaCode :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
areaCode} -> Text
areaCode) (\s :: GeoMatchParams
s@GeoMatchParams' {} Text
a -> GeoMatchParams
s {$sel:areaCode:GeoMatchParams' :: Text
areaCode = Text
a} :: GeoMatchParams)

instance Core.FromJSON GeoMatchParams where
  parseJSON :: Value -> Parser GeoMatchParams
parseJSON =
    String
-> (Object -> Parser GeoMatchParams)
-> Value
-> Parser GeoMatchParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GeoMatchParams"
      ( \Object
x ->
          Text -> Text -> GeoMatchParams
GeoMatchParams'
            (Text -> Text -> GeoMatchParams)
-> Parser Text -> Parser (Text -> GeoMatchParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Country")
            Parser (Text -> GeoMatchParams)
-> Parser Text -> Parser GeoMatchParams
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AreaCode")
      )

instance Prelude.Hashable GeoMatchParams

instance Prelude.NFData GeoMatchParams

instance Core.ToJSON GeoMatchParams where
  toJSON :: GeoMatchParams -> Value
toJSON GeoMatchParams' {Text
areaCode :: Text
country :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Country" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
country),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AreaCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
areaCode)
          ]
      )