{-# 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.Athena.Types.NotebookSessionSummary
-- 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.Athena.Types.NotebookSessionSummary 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

-- | Contains the notebook session ID and notebook session creation time.
--
-- /See:/ 'newNotebookSessionSummary' smart constructor.
data NotebookSessionSummary = NotebookSessionSummary'
  { -- | The time when the notebook session was created.
    NotebookSessionSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The notebook session ID.
    NotebookSessionSummary -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text
  }
  deriving (NotebookSessionSummary -> NotebookSessionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookSessionSummary -> NotebookSessionSummary -> Bool
$c/= :: NotebookSessionSummary -> NotebookSessionSummary -> Bool
== :: NotebookSessionSummary -> NotebookSessionSummary -> Bool
$c== :: NotebookSessionSummary -> NotebookSessionSummary -> Bool
Prelude.Eq, ReadPrec [NotebookSessionSummary]
ReadPrec NotebookSessionSummary
Int -> ReadS NotebookSessionSummary
ReadS [NotebookSessionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotebookSessionSummary]
$creadListPrec :: ReadPrec [NotebookSessionSummary]
readPrec :: ReadPrec NotebookSessionSummary
$creadPrec :: ReadPrec NotebookSessionSummary
readList :: ReadS [NotebookSessionSummary]
$creadList :: ReadS [NotebookSessionSummary]
readsPrec :: Int -> ReadS NotebookSessionSummary
$creadsPrec :: Int -> ReadS NotebookSessionSummary
Prelude.Read, Int -> NotebookSessionSummary -> ShowS
[NotebookSessionSummary] -> ShowS
NotebookSessionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookSessionSummary] -> ShowS
$cshowList :: [NotebookSessionSummary] -> ShowS
show :: NotebookSessionSummary -> String
$cshow :: NotebookSessionSummary -> String
showsPrec :: Int -> NotebookSessionSummary -> ShowS
$cshowsPrec :: Int -> NotebookSessionSummary -> ShowS
Prelude.Show, forall x. Rep NotebookSessionSummary x -> NotebookSessionSummary
forall x. NotebookSessionSummary -> Rep NotebookSessionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotebookSessionSummary x -> NotebookSessionSummary
$cfrom :: forall x. NotebookSessionSummary -> Rep NotebookSessionSummary x
Prelude.Generic)

-- |
-- Create a value of 'NotebookSessionSummary' 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:
--
-- 'creationTime', 'notebookSessionSummary_creationTime' - The time when the notebook session was created.
--
-- 'sessionId', 'notebookSessionSummary_sessionId' - The notebook session ID.
newNotebookSessionSummary ::
  NotebookSessionSummary
newNotebookSessionSummary :: NotebookSessionSummary
newNotebookSessionSummary =
  NotebookSessionSummary'
    { $sel:creationTime:NotebookSessionSummary' :: Maybe POSIX
creationTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sessionId:NotebookSessionSummary' :: Maybe Text
sessionId = forall a. Maybe a
Prelude.Nothing
    }

-- | The time when the notebook session was created.
notebookSessionSummary_creationTime :: Lens.Lens' NotebookSessionSummary (Prelude.Maybe Prelude.UTCTime)
notebookSessionSummary_creationTime :: Lens' NotebookSessionSummary (Maybe UTCTime)
notebookSessionSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookSessionSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: NotebookSessionSummary
s@NotebookSessionSummary' {} Maybe POSIX
a -> NotebookSessionSummary
s {$sel:creationTime:NotebookSessionSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: NotebookSessionSummary) 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 notebook session ID.
notebookSessionSummary_sessionId :: Lens.Lens' NotebookSessionSummary (Prelude.Maybe Prelude.Text)
notebookSessionSummary_sessionId :: Lens' NotebookSessionSummary (Maybe Text)
notebookSessionSummary_sessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookSessionSummary' {Maybe Text
sessionId :: Maybe Text
$sel:sessionId:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe Text
sessionId} -> Maybe Text
sessionId) (\s :: NotebookSessionSummary
s@NotebookSessionSummary' {} Maybe Text
a -> NotebookSessionSummary
s {$sel:sessionId:NotebookSessionSummary' :: Maybe Text
sessionId = Maybe Text
a} :: NotebookSessionSummary)

instance Data.FromJSON NotebookSessionSummary where
  parseJSON :: Value -> Parser NotebookSessionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NotebookSessionSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> NotebookSessionSummary
NotebookSessionSummary'
            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
"CreationTime")
            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
"SessionId")
      )

instance Prelude.Hashable NotebookSessionSummary where
  hashWithSalt :: Int -> NotebookSessionSummary -> Int
hashWithSalt Int
_salt NotebookSessionSummary' {Maybe Text
Maybe POSIX
sessionId :: Maybe Text
creationTime :: Maybe POSIX
$sel:sessionId:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe Text
$sel:creationTime:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sessionId

instance Prelude.NFData NotebookSessionSummary where
  rnf :: NotebookSessionSummary -> ()
rnf NotebookSessionSummary' {Maybe Text
Maybe POSIX
sessionId :: Maybe Text
creationTime :: Maybe POSIX
$sel:sessionId:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe Text
$sel:creationTime:NotebookSessionSummary' :: NotebookSessionSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionId