{-# 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.CustomerProfiles.Types.ListDomainItem
-- 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.CustomerProfiles.Types.ListDomainItem 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

-- | An object in a list that represents a domain.
--
-- /See:/ 'newListDomainItem' smart constructor.
data ListDomainItem = ListDomainItem'
  { -- | The tags used to organize, track, or control access for this resource.
    ListDomainItem -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique name of the domain.
    ListDomainItem -> Text
domainName :: Prelude.Text,
    -- | The timestamp of when the domain was created.
    ListDomainItem -> POSIX
createdAt :: Data.POSIX,
    -- | The timestamp of when the domain was most recently edited.
    ListDomainItem -> POSIX
lastUpdatedAt :: Data.POSIX
  }
  deriving (ListDomainItem -> ListDomainItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDomainItem -> ListDomainItem -> Bool
$c/= :: ListDomainItem -> ListDomainItem -> Bool
== :: ListDomainItem -> ListDomainItem -> Bool
$c== :: ListDomainItem -> ListDomainItem -> Bool
Prelude.Eq, ReadPrec [ListDomainItem]
ReadPrec ListDomainItem
Int -> ReadS ListDomainItem
ReadS [ListDomainItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDomainItem]
$creadListPrec :: ReadPrec [ListDomainItem]
readPrec :: ReadPrec ListDomainItem
$creadPrec :: ReadPrec ListDomainItem
readList :: ReadS [ListDomainItem]
$creadList :: ReadS [ListDomainItem]
readsPrec :: Int -> ReadS ListDomainItem
$creadsPrec :: Int -> ReadS ListDomainItem
Prelude.Read, Int -> ListDomainItem -> ShowS
[ListDomainItem] -> ShowS
ListDomainItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDomainItem] -> ShowS
$cshowList :: [ListDomainItem] -> ShowS
show :: ListDomainItem -> String
$cshow :: ListDomainItem -> String
showsPrec :: Int -> ListDomainItem -> ShowS
$cshowsPrec :: Int -> ListDomainItem -> ShowS
Prelude.Show, forall x. Rep ListDomainItem x -> ListDomainItem
forall x. ListDomainItem -> Rep ListDomainItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDomainItem x -> ListDomainItem
$cfrom :: forall x. ListDomainItem -> Rep ListDomainItem x
Prelude.Generic)

-- |
-- Create a value of 'ListDomainItem' 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:
--
-- 'tags', 'listDomainItem_tags' - The tags used to organize, track, or control access for this resource.
--
-- 'domainName', 'listDomainItem_domainName' - The unique name of the domain.
--
-- 'createdAt', 'listDomainItem_createdAt' - The timestamp of when the domain was created.
--
-- 'lastUpdatedAt', 'listDomainItem_lastUpdatedAt' - The timestamp of when the domain was most recently edited.
newListDomainItem ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  ListDomainItem
newListDomainItem :: Text -> UTCTime -> UTCTime -> ListDomainItem
newListDomainItem
  Text
pDomainName_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_ =
    ListDomainItem'
      { $sel:tags:ListDomainItem' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:domainName:ListDomainItem' :: Text
domainName = Text
pDomainName_,
        $sel:createdAt:ListDomainItem' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:ListDomainItem' :: POSIX
lastUpdatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedAt_
      }

-- | The tags used to organize, track, or control access for this resource.
listDomainItem_tags :: Lens.Lens' ListDomainItem (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
listDomainItem_tags :: Lens' ListDomainItem (Maybe (HashMap Text Text))
listDomainItem_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ListDomainItem' :: ListDomainItem -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ListDomainItem
s@ListDomainItem' {} Maybe (HashMap Text Text)
a -> ListDomainItem
s {$sel:tags:ListDomainItem' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ListDomainItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique name of the domain.
listDomainItem_domainName :: Lens.Lens' ListDomainItem Prelude.Text
listDomainItem_domainName :: Lens' ListDomainItem Text
listDomainItem_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {Text
domainName :: Text
$sel:domainName:ListDomainItem' :: ListDomainItem -> Text
domainName} -> Text
domainName) (\s :: ListDomainItem
s@ListDomainItem' {} Text
a -> ListDomainItem
s {$sel:domainName:ListDomainItem' :: Text
domainName = Text
a} :: ListDomainItem)

-- | The timestamp of when the domain was created.
listDomainItem_createdAt :: Lens.Lens' ListDomainItem Prelude.UTCTime
listDomainItem_createdAt :: Lens' ListDomainItem UTCTime
listDomainItem_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {POSIX
createdAt :: POSIX
$sel:createdAt:ListDomainItem' :: ListDomainItem -> POSIX
createdAt} -> POSIX
createdAt) (\s :: ListDomainItem
s@ListDomainItem' {} POSIX
a -> ListDomainItem
s {$sel:createdAt:ListDomainItem' :: POSIX
createdAt = POSIX
a} :: ListDomainItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The timestamp of when the domain was most recently edited.
listDomainItem_lastUpdatedAt :: Lens.Lens' ListDomainItem Prelude.UTCTime
listDomainItem_lastUpdatedAt :: Lens' ListDomainItem UTCTime
listDomainItem_lastUpdatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:ListDomainItem' :: ListDomainItem -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: ListDomainItem
s@ListDomainItem' {} POSIX
a -> ListDomainItem
s {$sel:lastUpdatedAt:ListDomainItem' :: POSIX
lastUpdatedAt = POSIX
a} :: ListDomainItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ListDomainItem where
  parseJSON :: Value -> Parser ListDomainItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListDomainItem"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> POSIX -> POSIX -> ListDomainItem
ListDomainItem'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DomainName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CreatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LastUpdatedAt")
      )

instance Prelude.Hashable ListDomainItem where
  hashWithSalt :: Int -> ListDomainItem -> Int
hashWithSalt Int
_salt ListDomainItem' {Maybe (HashMap Text Text)
Text
POSIX
lastUpdatedAt :: POSIX
createdAt :: POSIX
domainName :: Text
tags :: Maybe (HashMap Text Text)
$sel:lastUpdatedAt:ListDomainItem' :: ListDomainItem -> POSIX
$sel:createdAt:ListDomainItem' :: ListDomainItem -> POSIX
$sel:domainName:ListDomainItem' :: ListDomainItem -> Text
$sel:tags:ListDomainItem' :: ListDomainItem -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdatedAt

instance Prelude.NFData ListDomainItem where
  rnf :: ListDomainItem -> ()
rnf ListDomainItem' {Maybe (HashMap Text Text)
Text
POSIX
lastUpdatedAt :: POSIX
createdAt :: POSIX
domainName :: Text
tags :: Maybe (HashMap Text Text)
$sel:lastUpdatedAt:ListDomainItem' :: ListDomainItem -> POSIX
$sel:createdAt:ListDomainItem' :: ListDomainItem -> POSIX
$sel:domainName:ListDomainItem' :: ListDomainItem -> Text
$sel:tags:ListDomainItem' :: ListDomainItem -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdatedAt