{-# 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.Route53.Types.GeoLocationDetails
-- 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.Route53.Types.GeoLocationDetails 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
import Amazonka.Route53.Internal

-- | A complex type that contains the codes and full continent, country, and
-- subdivision names for the specified @geolocation@ code.
--
-- /See:/ 'newGeoLocationDetails' smart constructor.
data GeoLocationDetails = GeoLocationDetails'
  { -- | The two-letter code for the continent.
    GeoLocationDetails -> Maybe Text
continentCode :: Prelude.Maybe Prelude.Text,
    -- | The full name of the continent.
    GeoLocationDetails -> Maybe Text
continentName :: Prelude.Maybe Prelude.Text,
    -- | The two-letter code for the country.
    GeoLocationDetails -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
    -- | The name of the country.
    GeoLocationDetails -> Maybe Text
countryName :: Prelude.Maybe Prelude.Text,
    -- | The code for the subdivision, such as a particular state within the
    -- United States. For a list of US state abbreviations, see
    -- <https://pe.usps.com/text/pub28/28apb.htm Appendix B: Two–Letter State and Possession Abbreviations>
    -- on the United States Postal Service website. For a list of all supported
    -- subdivision codes, use the
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListGeoLocations.html ListGeoLocations>
    -- API.
    GeoLocationDetails -> Maybe Text
subdivisionCode :: Prelude.Maybe Prelude.Text,
    -- | The full name of the subdivision. Route 53 currently supports only
    -- states in the United States.
    GeoLocationDetails -> Maybe Text
subdivisionName :: Prelude.Maybe Prelude.Text
  }
  deriving (GeoLocationDetails -> GeoLocationDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoLocationDetails -> GeoLocationDetails -> Bool
$c/= :: GeoLocationDetails -> GeoLocationDetails -> Bool
== :: GeoLocationDetails -> GeoLocationDetails -> Bool
$c== :: GeoLocationDetails -> GeoLocationDetails -> Bool
Prelude.Eq, ReadPrec [GeoLocationDetails]
ReadPrec GeoLocationDetails
Int -> ReadS GeoLocationDetails
ReadS [GeoLocationDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoLocationDetails]
$creadListPrec :: ReadPrec [GeoLocationDetails]
readPrec :: ReadPrec GeoLocationDetails
$creadPrec :: ReadPrec GeoLocationDetails
readList :: ReadS [GeoLocationDetails]
$creadList :: ReadS [GeoLocationDetails]
readsPrec :: Int -> ReadS GeoLocationDetails
$creadsPrec :: Int -> ReadS GeoLocationDetails
Prelude.Read, Int -> GeoLocationDetails -> ShowS
[GeoLocationDetails] -> ShowS
GeoLocationDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoLocationDetails] -> ShowS
$cshowList :: [GeoLocationDetails] -> ShowS
show :: GeoLocationDetails -> String
$cshow :: GeoLocationDetails -> String
showsPrec :: Int -> GeoLocationDetails -> ShowS
$cshowsPrec :: Int -> GeoLocationDetails -> ShowS
Prelude.Show, forall x. Rep GeoLocationDetails x -> GeoLocationDetails
forall x. GeoLocationDetails -> Rep GeoLocationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoLocationDetails x -> GeoLocationDetails
$cfrom :: forall x. GeoLocationDetails -> Rep GeoLocationDetails x
Prelude.Generic)

-- |
-- Create a value of 'GeoLocationDetails' 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:
--
-- 'continentCode', 'geoLocationDetails_continentCode' - The two-letter code for the continent.
--
-- 'continentName', 'geoLocationDetails_continentName' - The full name of the continent.
--
-- 'countryCode', 'geoLocationDetails_countryCode' - The two-letter code for the country.
--
-- 'countryName', 'geoLocationDetails_countryName' - The name of the country.
--
-- 'subdivisionCode', 'geoLocationDetails_subdivisionCode' - The code for the subdivision, such as a particular state within the
-- United States. For a list of US state abbreviations, see
-- <https://pe.usps.com/text/pub28/28apb.htm Appendix B: Two–Letter State and Possession Abbreviations>
-- on the United States Postal Service website. For a list of all supported
-- subdivision codes, use the
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListGeoLocations.html ListGeoLocations>
-- API.
--
-- 'subdivisionName', 'geoLocationDetails_subdivisionName' - The full name of the subdivision. Route 53 currently supports only
-- states in the United States.
newGeoLocationDetails ::
  GeoLocationDetails
newGeoLocationDetails :: GeoLocationDetails
newGeoLocationDetails =
  GeoLocationDetails'
    { $sel:continentCode:GeoLocationDetails' :: Maybe Text
continentCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:continentName:GeoLocationDetails' :: Maybe Text
continentName = forall a. Maybe a
Prelude.Nothing,
      $sel:countryCode:GeoLocationDetails' :: Maybe Text
countryCode = forall a. Maybe a
Prelude.Nothing,
      $sel:countryName:GeoLocationDetails' :: Maybe Text
countryName = forall a. Maybe a
Prelude.Nothing,
      $sel:subdivisionCode:GeoLocationDetails' :: Maybe Text
subdivisionCode = forall a. Maybe a
Prelude.Nothing,
      $sel:subdivisionName:GeoLocationDetails' :: Maybe Text
subdivisionName = forall a. Maybe a
Prelude.Nothing
    }

-- | The two-letter code for the continent.
geoLocationDetails_continentCode :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_continentCode :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_continentCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
continentCode :: Maybe Text
$sel:continentCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
continentCode} -> Maybe Text
continentCode) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:continentCode:GeoLocationDetails' :: Maybe Text
continentCode = Maybe Text
a} :: GeoLocationDetails)

-- | The full name of the continent.
geoLocationDetails_continentName :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_continentName :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_continentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
continentName :: Maybe Text
$sel:continentName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
continentName} -> Maybe Text
continentName) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:continentName:GeoLocationDetails' :: Maybe Text
continentName = Maybe Text
a} :: GeoLocationDetails)

-- | The two-letter code for the country.
geoLocationDetails_countryCode :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_countryCode :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_countryCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
countryCode :: Maybe Text
$sel:countryCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
countryCode} -> Maybe Text
countryCode) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:countryCode:GeoLocationDetails' :: Maybe Text
countryCode = Maybe Text
a} :: GeoLocationDetails)

-- | The name of the country.
geoLocationDetails_countryName :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_countryName :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_countryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
countryName :: Maybe Text
$sel:countryName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
countryName} -> Maybe Text
countryName) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:countryName:GeoLocationDetails' :: Maybe Text
countryName = Maybe Text
a} :: GeoLocationDetails)

-- | The code for the subdivision, such as a particular state within the
-- United States. For a list of US state abbreviations, see
-- <https://pe.usps.com/text/pub28/28apb.htm Appendix B: Two–Letter State and Possession Abbreviations>
-- on the United States Postal Service website. For a list of all supported
-- subdivision codes, use the
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListGeoLocations.html ListGeoLocations>
-- API.
geoLocationDetails_subdivisionCode :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_subdivisionCode :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_subdivisionCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
subdivisionCode :: Maybe Text
$sel:subdivisionCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
subdivisionCode} -> Maybe Text
subdivisionCode) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:subdivisionCode:GeoLocationDetails' :: Maybe Text
subdivisionCode = Maybe Text
a} :: GeoLocationDetails)

-- | The full name of the subdivision. Route 53 currently supports only
-- states in the United States.
geoLocationDetails_subdivisionName :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_subdivisionName :: Lens' GeoLocationDetails (Maybe Text)
geoLocationDetails_subdivisionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocationDetails' {Maybe Text
subdivisionName :: Maybe Text
$sel:subdivisionName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
subdivisionName} -> Maybe Text
subdivisionName) (\s :: GeoLocationDetails
s@GeoLocationDetails' {} Maybe Text
a -> GeoLocationDetails
s {$sel:subdivisionName:GeoLocationDetails' :: Maybe Text
subdivisionName = Maybe Text
a} :: GeoLocationDetails)

instance Data.FromXML GeoLocationDetails where
  parseXML :: [Node] -> Either String GeoLocationDetails
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GeoLocationDetails
GeoLocationDetails'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ContinentCode")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ContinentName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CountryCode")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CountryName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SubdivisionCode")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SubdivisionName")

instance Prelude.Hashable GeoLocationDetails where
  hashWithSalt :: Int -> GeoLocationDetails -> Int
hashWithSalt Int
_salt GeoLocationDetails' {Maybe Text
subdivisionName :: Maybe Text
subdivisionCode :: Maybe Text
countryName :: Maybe Text
countryCode :: Maybe Text
continentName :: Maybe Text
continentCode :: Maybe Text
$sel:subdivisionName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:subdivisionCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:countryName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:countryCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:continentName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:continentCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
continentCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
continentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
countryCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
countryName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subdivisionCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subdivisionName

instance Prelude.NFData GeoLocationDetails where
  rnf :: GeoLocationDetails -> ()
rnf GeoLocationDetails' {Maybe Text
subdivisionName :: Maybe Text
subdivisionCode :: Maybe Text
countryName :: Maybe Text
countryCode :: Maybe Text
continentName :: Maybe Text
continentCode :: Maybe Text
$sel:subdivisionName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:subdivisionCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:countryName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:countryCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:continentName:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
$sel:continentCode:GeoLocationDetails' :: GeoLocationDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
continentCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
continentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
countryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subdivisionCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subdivisionName