{-# 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.Route53Domains.Types.DomainSuggestion
-- 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.Route53Domains.Types.DomainSuggestion where

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

-- | Information about one suggested domain name.
--
-- /See:/ 'newDomainSuggestion' smart constructor.
data DomainSuggestion = DomainSuggestion'
  { -- | Whether the domain name is available for registering.
    --
    -- You can register only the domains that are designated as @AVAILABLE@.
    --
    -- Valid values:
    --
    -- [AVAILABLE]
    --     The domain name is available.
    --
    -- [AVAILABLE_RESERVED]
    --     The domain name is reserved under specific conditions.
    --
    -- [AVAILABLE_PREORDER]
    --     The domain name is available and can be preordered.
    --
    -- [DONT_KNOW]
    --     The TLD registry didn\'t reply with a definitive answer about
    --     whether the domain name is available. Route 53 can return this
    --     response for a variety of reasons, for example, the registry is
    --     performing maintenance. Try again later.
    --
    -- [PENDING]
    --     The TLD registry didn\'t return a response in the expected amount of
    --     time. When the response is delayed, it usually takes just a few
    --     extra seconds. You can resubmit the request immediately.
    --
    -- [RESERVED]
    --     The domain name has been reserved for another person or
    --     organization.
    --
    -- [UNAVAILABLE]
    --     The domain name is not available.
    --
    -- [UNAVAILABLE_PREMIUM]
    --     The domain name is not available.
    --
    -- [UNAVAILABLE_RESTRICTED]
    --     The domain name is forbidden.
    DomainSuggestion -> Maybe Text
availability :: Prelude.Maybe Prelude.Text,
    -- | A suggested domain name.
    DomainSuggestion -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text
  }
  deriving (DomainSuggestion -> DomainSuggestion -> Bool
(DomainSuggestion -> DomainSuggestion -> Bool)
-> (DomainSuggestion -> DomainSuggestion -> Bool)
-> Eq DomainSuggestion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainSuggestion -> DomainSuggestion -> Bool
$c/= :: DomainSuggestion -> DomainSuggestion -> Bool
== :: DomainSuggestion -> DomainSuggestion -> Bool
$c== :: DomainSuggestion -> DomainSuggestion -> Bool
Prelude.Eq, ReadPrec [DomainSuggestion]
ReadPrec DomainSuggestion
Int -> ReadS DomainSuggestion
ReadS [DomainSuggestion]
(Int -> ReadS DomainSuggestion)
-> ReadS [DomainSuggestion]
-> ReadPrec DomainSuggestion
-> ReadPrec [DomainSuggestion]
-> Read DomainSuggestion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainSuggestion]
$creadListPrec :: ReadPrec [DomainSuggestion]
readPrec :: ReadPrec DomainSuggestion
$creadPrec :: ReadPrec DomainSuggestion
readList :: ReadS [DomainSuggestion]
$creadList :: ReadS [DomainSuggestion]
readsPrec :: Int -> ReadS DomainSuggestion
$creadsPrec :: Int -> ReadS DomainSuggestion
Prelude.Read, Int -> DomainSuggestion -> ShowS
[DomainSuggestion] -> ShowS
DomainSuggestion -> String
(Int -> DomainSuggestion -> ShowS)
-> (DomainSuggestion -> String)
-> ([DomainSuggestion] -> ShowS)
-> Show DomainSuggestion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainSuggestion] -> ShowS
$cshowList :: [DomainSuggestion] -> ShowS
show :: DomainSuggestion -> String
$cshow :: DomainSuggestion -> String
showsPrec :: Int -> DomainSuggestion -> ShowS
$cshowsPrec :: Int -> DomainSuggestion -> ShowS
Prelude.Show, (forall x. DomainSuggestion -> Rep DomainSuggestion x)
-> (forall x. Rep DomainSuggestion x -> DomainSuggestion)
-> Generic DomainSuggestion
forall x. Rep DomainSuggestion x -> DomainSuggestion
forall x. DomainSuggestion -> Rep DomainSuggestion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainSuggestion x -> DomainSuggestion
$cfrom :: forall x. DomainSuggestion -> Rep DomainSuggestion x
Prelude.Generic)

-- |
-- Create a value of 'DomainSuggestion' 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:
--
-- 'availability', 'domainSuggestion_availability' - Whether the domain name is available for registering.
--
-- You can register only the domains that are designated as @AVAILABLE@.
--
-- Valid values:
--
-- [AVAILABLE]
--     The domain name is available.
--
-- [AVAILABLE_RESERVED]
--     The domain name is reserved under specific conditions.
--
-- [AVAILABLE_PREORDER]
--     The domain name is available and can be preordered.
--
-- [DONT_KNOW]
--     The TLD registry didn\'t reply with a definitive answer about
--     whether the domain name is available. Route 53 can return this
--     response for a variety of reasons, for example, the registry is
--     performing maintenance. Try again later.
--
-- [PENDING]
--     The TLD registry didn\'t return a response in the expected amount of
--     time. When the response is delayed, it usually takes just a few
--     extra seconds. You can resubmit the request immediately.
--
-- [RESERVED]
--     The domain name has been reserved for another person or
--     organization.
--
-- [UNAVAILABLE]
--     The domain name is not available.
--
-- [UNAVAILABLE_PREMIUM]
--     The domain name is not available.
--
-- [UNAVAILABLE_RESTRICTED]
--     The domain name is forbidden.
--
-- 'domainName', 'domainSuggestion_domainName' - A suggested domain name.
newDomainSuggestion ::
  DomainSuggestion
newDomainSuggestion :: DomainSuggestion
newDomainSuggestion =
  DomainSuggestion' :: Maybe Text -> Maybe Text -> DomainSuggestion
DomainSuggestion'
    { $sel:availability:DomainSuggestion' :: Maybe Text
availability = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:DomainSuggestion' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether the domain name is available for registering.
--
-- You can register only the domains that are designated as @AVAILABLE@.
--
-- Valid values:
--
-- [AVAILABLE]
--     The domain name is available.
--
-- [AVAILABLE_RESERVED]
--     The domain name is reserved under specific conditions.
--
-- [AVAILABLE_PREORDER]
--     The domain name is available and can be preordered.
--
-- [DONT_KNOW]
--     The TLD registry didn\'t reply with a definitive answer about
--     whether the domain name is available. Route 53 can return this
--     response for a variety of reasons, for example, the registry is
--     performing maintenance. Try again later.
--
-- [PENDING]
--     The TLD registry didn\'t return a response in the expected amount of
--     time. When the response is delayed, it usually takes just a few
--     extra seconds. You can resubmit the request immediately.
--
-- [RESERVED]
--     The domain name has been reserved for another person or
--     organization.
--
-- [UNAVAILABLE]
--     The domain name is not available.
--
-- [UNAVAILABLE_PREMIUM]
--     The domain name is not available.
--
-- [UNAVAILABLE_RESTRICTED]
--     The domain name is forbidden.
domainSuggestion_availability :: Lens.Lens' DomainSuggestion (Prelude.Maybe Prelude.Text)
domainSuggestion_availability :: (Maybe Text -> f (Maybe Text))
-> DomainSuggestion -> f DomainSuggestion
domainSuggestion_availability = (DomainSuggestion -> Maybe Text)
-> (DomainSuggestion -> Maybe Text -> DomainSuggestion)
-> Lens DomainSuggestion DomainSuggestion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSuggestion' {Maybe Text
availability :: Maybe Text
$sel:availability:DomainSuggestion' :: DomainSuggestion -> Maybe Text
availability} -> Maybe Text
availability) (\s :: DomainSuggestion
s@DomainSuggestion' {} Maybe Text
a -> DomainSuggestion
s {$sel:availability:DomainSuggestion' :: Maybe Text
availability = Maybe Text
a} :: DomainSuggestion)

-- | A suggested domain name.
domainSuggestion_domainName :: Lens.Lens' DomainSuggestion (Prelude.Maybe Prelude.Text)
domainSuggestion_domainName :: (Maybe Text -> f (Maybe Text))
-> DomainSuggestion -> f DomainSuggestion
domainSuggestion_domainName = (DomainSuggestion -> Maybe Text)
-> (DomainSuggestion -> Maybe Text -> DomainSuggestion)
-> Lens DomainSuggestion DomainSuggestion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSuggestion' {Maybe Text
domainName :: Maybe Text
$sel:domainName:DomainSuggestion' :: DomainSuggestion -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: DomainSuggestion
s@DomainSuggestion' {} Maybe Text
a -> DomainSuggestion
s {$sel:domainName:DomainSuggestion' :: Maybe Text
domainName = Maybe Text
a} :: DomainSuggestion)

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

instance Prelude.Hashable DomainSuggestion

instance Prelude.NFData DomainSuggestion