{-# 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.QuickSight.Types.TemplateSummary
-- 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.QuickSight.Types.TemplateSummary 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

-- | The template summary.
--
-- /See:/ 'newTemplateSummary' smart constructor.
data TemplateSummary = TemplateSummary'
  { -- | A summary of a template.
    TemplateSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The last time that this template was created.
    TemplateSummary -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The last time that this template was updated.
    TemplateSummary -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | A structure containing a list of version numbers for the template
    -- summary.
    TemplateSummary -> Maybe Natural
latestVersionNumber :: Prelude.Maybe Prelude.Natural,
    -- | A display name for the template.
    TemplateSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the template. This ID is unique per Amazon Web Services Region
    -- for each Amazon Web Services account.
    TemplateSummary -> Maybe Text
templateId :: Prelude.Maybe Prelude.Text
  }
  deriving (TemplateSummary -> TemplateSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateSummary -> TemplateSummary -> Bool
$c/= :: TemplateSummary -> TemplateSummary -> Bool
== :: TemplateSummary -> TemplateSummary -> Bool
$c== :: TemplateSummary -> TemplateSummary -> Bool
Prelude.Eq, ReadPrec [TemplateSummary]
ReadPrec TemplateSummary
Int -> ReadS TemplateSummary
ReadS [TemplateSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateSummary]
$creadListPrec :: ReadPrec [TemplateSummary]
readPrec :: ReadPrec TemplateSummary
$creadPrec :: ReadPrec TemplateSummary
readList :: ReadS [TemplateSummary]
$creadList :: ReadS [TemplateSummary]
readsPrec :: Int -> ReadS TemplateSummary
$creadsPrec :: Int -> ReadS TemplateSummary
Prelude.Read, Int -> TemplateSummary -> ShowS
[TemplateSummary] -> ShowS
TemplateSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateSummary] -> ShowS
$cshowList :: [TemplateSummary] -> ShowS
show :: TemplateSummary -> String
$cshow :: TemplateSummary -> String
showsPrec :: Int -> TemplateSummary -> ShowS
$cshowsPrec :: Int -> TemplateSummary -> ShowS
Prelude.Show, forall x. Rep TemplateSummary x -> TemplateSummary
forall x. TemplateSummary -> Rep TemplateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateSummary x -> TemplateSummary
$cfrom :: forall x. TemplateSummary -> Rep TemplateSummary x
Prelude.Generic)

-- |
-- Create a value of 'TemplateSummary' 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:
--
-- 'arn', 'templateSummary_arn' - A summary of a template.
--
-- 'createdTime', 'templateSummary_createdTime' - The last time that this template was created.
--
-- 'lastUpdatedTime', 'templateSummary_lastUpdatedTime' - The last time that this template was updated.
--
-- 'latestVersionNumber', 'templateSummary_latestVersionNumber' - A structure containing a list of version numbers for the template
-- summary.
--
-- 'name', 'templateSummary_name' - A display name for the template.
--
-- 'templateId', 'templateSummary_templateId' - The ID of the template. This ID is unique per Amazon Web Services Region
-- for each Amazon Web Services account.
newTemplateSummary ::
  TemplateSummary
newTemplateSummary :: TemplateSummary
newTemplateSummary =
  TemplateSummary'
    { $sel:arn:TemplateSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:TemplateSummary' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:TemplateSummary' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersionNumber:TemplateSummary' :: Maybe Natural
latestVersionNumber = forall a. Maybe a
Prelude.Nothing,
      $sel:name:TemplateSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:templateId:TemplateSummary' :: Maybe Text
templateId = forall a. Maybe a
Prelude.Nothing
    }

-- | A summary of a template.
templateSummary_arn :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.Text)
templateSummary_arn :: Lens' TemplateSummary (Maybe Text)
templateSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:TemplateSummary' :: TemplateSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe Text
a -> TemplateSummary
s {$sel:arn:TemplateSummary' :: Maybe Text
arn = Maybe Text
a} :: TemplateSummary)

-- | The last time that this template was created.
templateSummary_createdTime :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.UTCTime)
templateSummary_createdTime :: Lens' TemplateSummary (Maybe UTCTime)
templateSummary_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe POSIX
a -> TemplateSummary
s {$sel:createdTime:TemplateSummary' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: TemplateSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The last time that this template was updated.
templateSummary_lastUpdatedTime :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.UTCTime)
templateSummary_lastUpdatedTime :: Lens' TemplateSummary (Maybe UTCTime)
templateSummary_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe POSIX
a -> TemplateSummary
s {$sel:lastUpdatedTime:TemplateSummary' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: TemplateSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A structure containing a list of version numbers for the template
-- summary.
templateSummary_latestVersionNumber :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.Natural)
templateSummary_latestVersionNumber :: Lens' TemplateSummary (Maybe Natural)
templateSummary_latestVersionNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe Natural
latestVersionNumber :: Maybe Natural
$sel:latestVersionNumber:TemplateSummary' :: TemplateSummary -> Maybe Natural
latestVersionNumber} -> Maybe Natural
latestVersionNumber) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe Natural
a -> TemplateSummary
s {$sel:latestVersionNumber:TemplateSummary' :: Maybe Natural
latestVersionNumber = Maybe Natural
a} :: TemplateSummary)

-- | A display name for the template.
templateSummary_name :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.Text)
templateSummary_name :: Lens' TemplateSummary (Maybe Text)
templateSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe Text
name :: Maybe Text
$sel:name:TemplateSummary' :: TemplateSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe Text
a -> TemplateSummary
s {$sel:name:TemplateSummary' :: Maybe Text
name = Maybe Text
a} :: TemplateSummary)

-- | The ID of the template. This ID is unique per Amazon Web Services Region
-- for each Amazon Web Services account.
templateSummary_templateId :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.Text)
templateSummary_templateId :: Lens' TemplateSummary (Maybe Text)
templateSummary_templateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe Text
templateId :: Maybe Text
$sel:templateId:TemplateSummary' :: TemplateSummary -> Maybe Text
templateId} -> Maybe Text
templateId) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe Text
a -> TemplateSummary
s {$sel:templateId:TemplateSummary' :: Maybe Text
templateId = Maybe Text
a} :: TemplateSummary)

instance Data.FromJSON TemplateSummary where
  parseJSON :: Value -> Parser TemplateSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemplateSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> TemplateSummary
TemplateSummary'
            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
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LatestVersionNumber")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TemplateId")
      )

instance Prelude.Hashable TemplateSummary where
  hashWithSalt :: Int -> TemplateSummary -> Int
hashWithSalt Int
_salt TemplateSummary' {Maybe Natural
Maybe Text
Maybe POSIX
templateId :: Maybe Text
name :: Maybe Text
latestVersionNumber :: Maybe Natural
lastUpdatedTime :: Maybe POSIX
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:templateId:TemplateSummary' :: TemplateSummary -> Maybe Text
$sel:name:TemplateSummary' :: TemplateSummary -> Maybe Text
$sel:latestVersionNumber:TemplateSummary' :: TemplateSummary -> Maybe Natural
$sel:lastUpdatedTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
$sel:createdTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
$sel:arn:TemplateSummary' :: TemplateSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
latestVersionNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
templateId

instance Prelude.NFData TemplateSummary where
  rnf :: TemplateSummary -> ()
rnf TemplateSummary' {Maybe Natural
Maybe Text
Maybe POSIX
templateId :: Maybe Text
name :: Maybe Text
latestVersionNumber :: Maybe Natural
lastUpdatedTime :: Maybe POSIX
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:templateId:TemplateSummary' :: TemplateSummary -> Maybe Text
$sel:name:TemplateSummary' :: TemplateSummary -> Maybe Text
$sel:latestVersionNumber:TemplateSummary' :: TemplateSummary -> Maybe Natural
$sel:lastUpdatedTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
$sel:createdTime:TemplateSummary' :: TemplateSummary -> Maybe POSIX
$sel:arn:TemplateSummary' :: TemplateSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
latestVersionNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
templateId