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

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

-- | Summary information about one domain.
--
-- /See:/ 'newDomainSummary' smart constructor.
data DomainSummary = DomainSummary'
  { -- | Expiration date of the domain in Unix time format and Coordinated
    -- Universal Time (UTC).
    DomainSummary -> Maybe POSIX
expiry :: Prelude.Maybe Core.POSIX,
    -- | Indicates whether a domain is locked from unauthorized transfer to
    -- another party.
    DomainSummary -> Maybe Bool
transferLock :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether the domain is automatically renewed upon expiration.
    DomainSummary -> Maybe Bool
autoRenew :: Prelude.Maybe Prelude.Bool,
    -- | The name of the domain that the summary information applies to.
    DomainSummary -> Text
domainName :: Prelude.Text
  }
  deriving (DomainSummary -> DomainSummary -> Bool
(DomainSummary -> DomainSummary -> Bool)
-> (DomainSummary -> DomainSummary -> Bool) -> Eq DomainSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainSummary -> DomainSummary -> Bool
$c/= :: DomainSummary -> DomainSummary -> Bool
== :: DomainSummary -> DomainSummary -> Bool
$c== :: DomainSummary -> DomainSummary -> Bool
Prelude.Eq, ReadPrec [DomainSummary]
ReadPrec DomainSummary
Int -> ReadS DomainSummary
ReadS [DomainSummary]
(Int -> ReadS DomainSummary)
-> ReadS [DomainSummary]
-> ReadPrec DomainSummary
-> ReadPrec [DomainSummary]
-> Read DomainSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainSummary]
$creadListPrec :: ReadPrec [DomainSummary]
readPrec :: ReadPrec DomainSummary
$creadPrec :: ReadPrec DomainSummary
readList :: ReadS [DomainSummary]
$creadList :: ReadS [DomainSummary]
readsPrec :: Int -> ReadS DomainSummary
$creadsPrec :: Int -> ReadS DomainSummary
Prelude.Read, Int -> DomainSummary -> ShowS
[DomainSummary] -> ShowS
DomainSummary -> String
(Int -> DomainSummary -> ShowS)
-> (DomainSummary -> String)
-> ([DomainSummary] -> ShowS)
-> Show DomainSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainSummary] -> ShowS
$cshowList :: [DomainSummary] -> ShowS
show :: DomainSummary -> String
$cshow :: DomainSummary -> String
showsPrec :: Int -> DomainSummary -> ShowS
$cshowsPrec :: Int -> DomainSummary -> ShowS
Prelude.Show, (forall x. DomainSummary -> Rep DomainSummary x)
-> (forall x. Rep DomainSummary x -> DomainSummary)
-> Generic DomainSummary
forall x. Rep DomainSummary x -> DomainSummary
forall x. DomainSummary -> Rep DomainSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainSummary x -> DomainSummary
$cfrom :: forall x. DomainSummary -> Rep DomainSummary x
Prelude.Generic)

-- |
-- Create a value of 'DomainSummary' 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:
--
-- 'expiry', 'domainSummary_expiry' - Expiration date of the domain in Unix time format and Coordinated
-- Universal Time (UTC).
--
-- 'transferLock', 'domainSummary_transferLock' - Indicates whether a domain is locked from unauthorized transfer to
-- another party.
--
-- 'autoRenew', 'domainSummary_autoRenew' - Indicates whether the domain is automatically renewed upon expiration.
--
-- 'domainName', 'domainSummary_domainName' - The name of the domain that the summary information applies to.
newDomainSummary ::
  -- | 'domainName'
  Prelude.Text ->
  DomainSummary
newDomainSummary :: Text -> DomainSummary
newDomainSummary Text
pDomainName_ =
  DomainSummary' :: Maybe POSIX -> Maybe Bool -> Maybe Bool -> Text -> DomainSummary
DomainSummary'
    { $sel:expiry:DomainSummary' :: Maybe POSIX
expiry = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:transferLock:DomainSummary' :: Maybe Bool
transferLock = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:autoRenew:DomainSummary' :: Maybe Bool
autoRenew = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:DomainSummary' :: Text
domainName = Text
pDomainName_
    }

-- | Expiration date of the domain in Unix time format and Coordinated
-- Universal Time (UTC).
domainSummary_expiry :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.UTCTime)
domainSummary_expiry :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainSummary -> f DomainSummary
domainSummary_expiry = (DomainSummary -> Maybe POSIX)
-> (DomainSummary -> Maybe POSIX -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe POSIX
expiry :: Maybe POSIX
$sel:expiry:DomainSummary' :: DomainSummary -> Maybe POSIX
expiry} -> Maybe POSIX
expiry) (\s :: DomainSummary
s@DomainSummary' {} Maybe POSIX
a -> DomainSummary
s {$sel:expiry:DomainSummary' :: Maybe POSIX
expiry = Maybe POSIX
a} :: DomainSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DomainSummary -> f DomainSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainSummary
-> f DomainSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indicates whether a domain is locked from unauthorized transfer to
-- another party.
domainSummary_transferLock :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Bool)
domainSummary_transferLock :: (Maybe Bool -> f (Maybe Bool)) -> DomainSummary -> f DomainSummary
domainSummary_transferLock = (DomainSummary -> Maybe Bool)
-> (DomainSummary -> Maybe Bool -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Bool
transferLock :: Maybe Bool
$sel:transferLock:DomainSummary' :: DomainSummary -> Maybe Bool
transferLock} -> Maybe Bool
transferLock) (\s :: DomainSummary
s@DomainSummary' {} Maybe Bool
a -> DomainSummary
s {$sel:transferLock:DomainSummary' :: Maybe Bool
transferLock = Maybe Bool
a} :: DomainSummary)

-- | Indicates whether the domain is automatically renewed upon expiration.
domainSummary_autoRenew :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Bool)
domainSummary_autoRenew :: (Maybe Bool -> f (Maybe Bool)) -> DomainSummary -> f DomainSummary
domainSummary_autoRenew = (DomainSummary -> Maybe Bool)
-> (DomainSummary -> Maybe Bool -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Bool
autoRenew :: Maybe Bool
$sel:autoRenew:DomainSummary' :: DomainSummary -> Maybe Bool
autoRenew} -> Maybe Bool
autoRenew) (\s :: DomainSummary
s@DomainSummary' {} Maybe Bool
a -> DomainSummary
s {$sel:autoRenew:DomainSummary' :: Maybe Bool
autoRenew = Maybe Bool
a} :: DomainSummary)

-- | The name of the domain that the summary information applies to.
domainSummary_domainName :: Lens.Lens' DomainSummary Prelude.Text
domainSummary_domainName :: (Text -> f Text) -> DomainSummary -> f DomainSummary
domainSummary_domainName = (DomainSummary -> Text)
-> (DomainSummary -> Text -> DomainSummary)
-> Lens DomainSummary DomainSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Text
domainName :: Text
$sel:domainName:DomainSummary' :: DomainSummary -> Text
domainName} -> Text
domainName) (\s :: DomainSummary
s@DomainSummary' {} Text
a -> DomainSummary
s {$sel:domainName:DomainSummary' :: Text
domainName = Text
a} :: DomainSummary)

instance Core.FromJSON DomainSummary where
  parseJSON :: Value -> Parser DomainSummary
parseJSON =
    String
-> (Object -> Parser DomainSummary)
-> Value
-> Parser DomainSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Bool -> Maybe Bool -> Text -> DomainSummary
DomainSummary'
            (Maybe POSIX -> Maybe Bool -> Maybe Bool -> Text -> DomainSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Bool -> Maybe Bool -> Text -> DomainSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Expiry")
            Parser (Maybe Bool -> Maybe Bool -> Text -> DomainSummary)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Text -> DomainSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TransferLock")
            Parser (Maybe Bool -> Text -> DomainSummary)
-> Parser (Maybe Bool) -> Parser (Text -> DomainSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutoRenew")
            Parser (Text -> DomainSummary)
-> Parser Text -> Parser DomainSummary
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
"DomainName")
      )

instance Prelude.Hashable DomainSummary

instance Prelude.NFData DomainSummary