{-# 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-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.Route53.Types.GeoLocationDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 full name of the subdivision. Route 53 currently supports only
    -- states in the United States.
    GeoLocationDetails -> Maybe Text
subdivisionName :: 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 name of the country.
    GeoLocationDetails -> Maybe Text
countryName :: Prelude.Maybe Prelude.Text,
    -- | The two-letter code for the country.
    GeoLocationDetails -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (GeoLocationDetails -> GeoLocationDetails -> Bool
(GeoLocationDetails -> GeoLocationDetails -> Bool)
-> (GeoLocationDetails -> GeoLocationDetails -> Bool)
-> Eq GeoLocationDetails
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]
(Int -> ReadS GeoLocationDetails)
-> ReadS [GeoLocationDetails]
-> ReadPrec GeoLocationDetails
-> ReadPrec [GeoLocationDetails]
-> Read 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
(Int -> GeoLocationDetails -> ShowS)
-> (GeoLocationDetails -> String)
-> ([GeoLocationDetails] -> ShowS)
-> Show GeoLocationDetails
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. GeoLocationDetails -> Rep GeoLocationDetails x)
-> (forall x. Rep GeoLocationDetails x -> GeoLocationDetails)
-> Generic GeoLocationDetails
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:
--
-- 'subdivisionName', 'geoLocationDetails_subdivisionName' - The full name of the subdivision. Route 53 currently supports only
-- states in the United States.
--
-- '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.
--
-- 'countryName', 'geoLocationDetails_countryName' - The name of the country.
--
-- 'countryCode', 'geoLocationDetails_countryCode' - The two-letter code for the country.
--
-- 'continentCode', 'geoLocationDetails_continentCode' - The two-letter code for the continent.
--
-- 'continentName', 'geoLocationDetails_continentName' - The full name of the continent.
newGeoLocationDetails ::
  GeoLocationDetails
newGeoLocationDetails :: GeoLocationDetails
newGeoLocationDetails =
  GeoLocationDetails' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GeoLocationDetails
GeoLocationDetails'
    { $sel:subdivisionName:GeoLocationDetails' :: Maybe Text
subdivisionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subdivisionCode:GeoLocationDetails' :: Maybe Text
subdivisionCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:countryName:GeoLocationDetails' :: Maybe Text
countryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:countryCode:GeoLocationDetails' :: Maybe Text
countryCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:continentCode:GeoLocationDetails' :: Maybe Text
continentCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:continentName:GeoLocationDetails' :: Maybe Text
continentName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_subdivisionName = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_subdivisionCode = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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 name of the country.
geoLocationDetails_countryName :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_countryName :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_countryName = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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 two-letter code for the country.
geoLocationDetails_countryCode :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_countryCode :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_countryCode = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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 two-letter code for the continent.
geoLocationDetails_continentCode :: Lens.Lens' GeoLocationDetails (Prelude.Maybe Prelude.Text)
geoLocationDetails_continentCode :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_continentCode = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> GeoLocationDetails -> f GeoLocationDetails
geoLocationDetails_continentName = (GeoLocationDetails -> Maybe Text)
-> (GeoLocationDetails -> Maybe Text -> GeoLocationDetails)
-> Lens
     GeoLocationDetails GeoLocationDetails (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable GeoLocationDetails

instance Prelude.NFData GeoLocationDetails