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

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:/ 'newGeoMatchParams' smart constructor.
data GeoMatchParams = GeoMatchParams'
  { GeoMatchParams -> Text
country :: Prelude.Text,
    GeoMatchParams -> Text
areaCode :: Prelude.Text
  }
  deriving (GeoMatchParams -> GeoMatchParams -> Bool
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]
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
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. 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' - Undocumented member.
--
-- 'areaCode', 'geoMatchParams_areaCode' - Undocumented member.
newGeoMatchParams ::
  -- | 'country'
  Prelude.Text ->
  -- | 'areaCode'
  Prelude.Text ->
  GeoMatchParams
newGeoMatchParams :: Text -> Text -> GeoMatchParams
newGeoMatchParams Text
pCountry_ Text
pAreaCode_ =
  GeoMatchParams'
    { $sel:country:GeoMatchParams' :: Text
country = Text
pCountry_,
      $sel:areaCode:GeoMatchParams' :: Text
areaCode = Text
pAreaCode_
    }

-- | Undocumented member.
geoMatchParams_country :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_country :: Lens' GeoMatchParams Text
geoMatchParams_country = 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)

-- | Undocumented member.
geoMatchParams_areaCode :: Lens.Lens' GeoMatchParams Prelude.Text
geoMatchParams_areaCode :: Lens' GeoMatchParams Text
geoMatchParams_areaCode = 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 Data.FromJSON GeoMatchParams where
  parseJSON :: Value -> Parser GeoMatchParams
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GeoMatchParams"
      ( \Object
x ->
          Text -> Text -> GeoMatchParams
GeoMatchParams'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Country")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AreaCode")
      )

instance Prelude.Hashable GeoMatchParams where
  hashWithSalt :: Int -> GeoMatchParams -> Int
hashWithSalt Int
_salt GeoMatchParams' {Text
areaCode :: Text
country :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
country
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
areaCode

instance Prelude.NFData GeoMatchParams where
  rnf :: GeoMatchParams -> ()
rnf GeoMatchParams' {Text
areaCode :: Text
country :: Text
$sel:areaCode:GeoMatchParams' :: GeoMatchParams -> Text
$sel:country:GeoMatchParams' :: GeoMatchParams -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
country
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
areaCode

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Country" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
country),
            forall a. a -> Maybe a
Prelude.Just (Key
"AreaCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
areaCode)
          ]
      )