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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkLink.Types.DomainStatus

-- | The summary of the domain.
--
-- /See:/ 'newDomainSummary' smart constructor.
data DomainSummary = DomainSummary'
  { -- | The name to display.
    DomainSummary -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain.
    DomainSummary -> Text
domainName :: Prelude.Text,
    -- | The time that the domain was created.
    DomainSummary -> POSIX
createdTime :: Core.POSIX,
    -- | The status of the domain.
    DomainSummary -> DomainStatus
domainStatus :: DomainStatus
  }
  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:
--
-- 'displayName', 'domainSummary_displayName' - The name to display.
--
-- 'domainName', 'domainSummary_domainName' - The name of the domain.
--
-- 'createdTime', 'domainSummary_createdTime' - The time that the domain was created.
--
-- 'domainStatus', 'domainSummary_domainStatus' - The status of the domain.
newDomainSummary ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'createdTime'
  Prelude.UTCTime ->
  -- | 'domainStatus'
  DomainStatus ->
  DomainSummary
newDomainSummary :: Text -> UTCTime -> DomainStatus -> DomainSummary
newDomainSummary
  Text
pDomainName_
  UTCTime
pCreatedTime_
  DomainStatus
pDomainStatus_ =
    DomainSummary' :: Maybe Text -> Text -> POSIX -> DomainStatus -> DomainSummary
DomainSummary'
      { $sel:displayName:DomainSummary' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domainName:DomainSummary' :: Text
domainName = Text
pDomainName_,
        $sel:createdTime:DomainSummary' :: POSIX
createdTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedTime_,
        $sel:domainStatus:DomainSummary' :: DomainStatus
domainStatus = DomainStatus
pDomainStatus_
      }

-- | The name to display.
domainSummary_displayName :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Text)
domainSummary_displayName :: (Maybe Text -> f (Maybe Text)) -> DomainSummary -> f DomainSummary
domainSummary_displayName = (DomainSummary -> Maybe Text)
-> (DomainSummary -> Maybe Text -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Text
displayName :: Maybe Text
$sel:displayName:DomainSummary' :: DomainSummary -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: DomainSummary
s@DomainSummary' {} Maybe Text
a -> DomainSummary
s {$sel:displayName:DomainSummary' :: Maybe Text
displayName = Maybe Text
a} :: DomainSummary)

-- | The name of the domain.
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)

-- | The time that the domain was created.
domainSummary_createdTime :: Lens.Lens' DomainSummary Prelude.UTCTime
domainSummary_createdTime :: (UTCTime -> f UTCTime) -> DomainSummary -> f DomainSummary
domainSummary_createdTime = (DomainSummary -> POSIX)
-> (DomainSummary -> POSIX -> DomainSummary)
-> Lens DomainSummary DomainSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {POSIX
createdTime :: POSIX
$sel:createdTime:DomainSummary' :: DomainSummary -> POSIX
createdTime} -> POSIX
createdTime) (\s :: DomainSummary
s@DomainSummary' {} POSIX
a -> DomainSummary
s {$sel:createdTime:DomainSummary' :: POSIX
createdTime = POSIX
a} :: DomainSummary) ((POSIX -> f POSIX) -> DomainSummary -> f DomainSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> DomainSummary
-> f DomainSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of the domain.
domainSummary_domainStatus :: Lens.Lens' DomainSummary DomainStatus
domainSummary_domainStatus :: (DomainStatus -> f DomainStatus)
-> DomainSummary -> f DomainSummary
domainSummary_domainStatus = (DomainSummary -> DomainStatus)
-> (DomainSummary -> DomainStatus -> DomainSummary)
-> Lens DomainSummary DomainSummary DomainStatus DomainStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {DomainStatus
domainStatus :: DomainStatus
$sel:domainStatus:DomainSummary' :: DomainSummary -> DomainStatus
domainStatus} -> DomainStatus
domainStatus) (\s :: DomainSummary
s@DomainSummary' {} DomainStatus
a -> DomainSummary
s {$sel:domainStatus:DomainSummary' :: DomainStatus
domainStatus = DomainStatus
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 Text -> Text -> POSIX -> DomainStatus -> DomainSummary
DomainSummary'
            (Maybe Text -> Text -> POSIX -> DomainStatus -> DomainSummary)
-> Parser (Maybe Text)
-> Parser (Text -> POSIX -> DomainStatus -> DomainSummary)
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
"DisplayName")
            Parser (Text -> POSIX -> DomainStatus -> DomainSummary)
-> Parser Text -> Parser (POSIX -> DomainStatus -> 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")
            Parser (POSIX -> DomainStatus -> DomainSummary)
-> Parser POSIX -> Parser (DomainStatus -> DomainSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreatedTime")
            Parser (DomainStatus -> DomainSummary)
-> Parser DomainStatus -> Parser DomainSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DomainStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DomainStatus")
      )

instance Prelude.Hashable DomainSummary

instance Prelude.NFData DomainSummary