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

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

-- | The name and last modified time of the prepared statement.
--
-- /See:/ 'newPreparedStatementSummary' smart constructor.
data PreparedStatementSummary = PreparedStatementSummary'
  { -- | The last modified time of the prepared statement.
    PreparedStatementSummary -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the prepared statement.
    PreparedStatementSummary -> Maybe Text
statementName :: Prelude.Maybe Prelude.Text
  }
  deriving (PreparedStatementSummary -> PreparedStatementSummary -> Bool
(PreparedStatementSummary -> PreparedStatementSummary -> Bool)
-> (PreparedStatementSummary -> PreparedStatementSummary -> Bool)
-> Eq PreparedStatementSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreparedStatementSummary -> PreparedStatementSummary -> Bool
$c/= :: PreparedStatementSummary -> PreparedStatementSummary -> Bool
== :: PreparedStatementSummary -> PreparedStatementSummary -> Bool
$c== :: PreparedStatementSummary -> PreparedStatementSummary -> Bool
Prelude.Eq, ReadPrec [PreparedStatementSummary]
ReadPrec PreparedStatementSummary
Int -> ReadS PreparedStatementSummary
ReadS [PreparedStatementSummary]
(Int -> ReadS PreparedStatementSummary)
-> ReadS [PreparedStatementSummary]
-> ReadPrec PreparedStatementSummary
-> ReadPrec [PreparedStatementSummary]
-> Read PreparedStatementSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PreparedStatementSummary]
$creadListPrec :: ReadPrec [PreparedStatementSummary]
readPrec :: ReadPrec PreparedStatementSummary
$creadPrec :: ReadPrec PreparedStatementSummary
readList :: ReadS [PreparedStatementSummary]
$creadList :: ReadS [PreparedStatementSummary]
readsPrec :: Int -> ReadS PreparedStatementSummary
$creadsPrec :: Int -> ReadS PreparedStatementSummary
Prelude.Read, Int -> PreparedStatementSummary -> ShowS
[PreparedStatementSummary] -> ShowS
PreparedStatementSummary -> String
(Int -> PreparedStatementSummary -> ShowS)
-> (PreparedStatementSummary -> String)
-> ([PreparedStatementSummary] -> ShowS)
-> Show PreparedStatementSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreparedStatementSummary] -> ShowS
$cshowList :: [PreparedStatementSummary] -> ShowS
show :: PreparedStatementSummary -> String
$cshow :: PreparedStatementSummary -> String
showsPrec :: Int -> PreparedStatementSummary -> ShowS
$cshowsPrec :: Int -> PreparedStatementSummary -> ShowS
Prelude.Show, (forall x.
 PreparedStatementSummary -> Rep PreparedStatementSummary x)
-> (forall x.
    Rep PreparedStatementSummary x -> PreparedStatementSummary)
-> Generic PreparedStatementSummary
forall x.
Rep PreparedStatementSummary x -> PreparedStatementSummary
forall x.
PreparedStatementSummary -> Rep PreparedStatementSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PreparedStatementSummary x -> PreparedStatementSummary
$cfrom :: forall x.
PreparedStatementSummary -> Rep PreparedStatementSummary x
Prelude.Generic)

-- |
-- Create a value of 'PreparedStatementSummary' 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:
--
-- 'lastModifiedTime', 'preparedStatementSummary_lastModifiedTime' - The last modified time of the prepared statement.
--
-- 'statementName', 'preparedStatementSummary_statementName' - The name of the prepared statement.
newPreparedStatementSummary ::
  PreparedStatementSummary
newPreparedStatementSummary :: PreparedStatementSummary
newPreparedStatementSummary =
  PreparedStatementSummary' :: Maybe POSIX -> Maybe Text -> PreparedStatementSummary
PreparedStatementSummary'
    { $sel:lastModifiedTime:PreparedStatementSummary' :: Maybe POSIX
lastModifiedTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:statementName:PreparedStatementSummary' :: Maybe Text
statementName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The last modified time of the prepared statement.
preparedStatementSummary_lastModifiedTime :: Lens.Lens' PreparedStatementSummary (Prelude.Maybe Prelude.UTCTime)
preparedStatementSummary_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PreparedStatementSummary -> f PreparedStatementSummary
preparedStatementSummary_lastModifiedTime = (PreparedStatementSummary -> Maybe POSIX)
-> (PreparedStatementSummary
    -> Maybe POSIX -> PreparedStatementSummary)
-> Lens
     PreparedStatementSummary
     PreparedStatementSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PreparedStatementSummary' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:PreparedStatementSummary' :: PreparedStatementSummary -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: PreparedStatementSummary
s@PreparedStatementSummary' {} Maybe POSIX
a -> PreparedStatementSummary
s {$sel:lastModifiedTime:PreparedStatementSummary' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: PreparedStatementSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> PreparedStatementSummary -> f PreparedStatementSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PreparedStatementSummary
-> f PreparedStatementSummary
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

-- | The name of the prepared statement.
preparedStatementSummary_statementName :: Lens.Lens' PreparedStatementSummary (Prelude.Maybe Prelude.Text)
preparedStatementSummary_statementName :: (Maybe Text -> f (Maybe Text))
-> PreparedStatementSummary -> f PreparedStatementSummary
preparedStatementSummary_statementName = (PreparedStatementSummary -> Maybe Text)
-> (PreparedStatementSummary
    -> Maybe Text -> PreparedStatementSummary)
-> Lens
     PreparedStatementSummary
     PreparedStatementSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PreparedStatementSummary' {Maybe Text
statementName :: Maybe Text
$sel:statementName:PreparedStatementSummary' :: PreparedStatementSummary -> Maybe Text
statementName} -> Maybe Text
statementName) (\s :: PreparedStatementSummary
s@PreparedStatementSummary' {} Maybe Text
a -> PreparedStatementSummary
s {$sel:statementName:PreparedStatementSummary' :: Maybe Text
statementName = Maybe Text
a} :: PreparedStatementSummary)

instance Core.FromJSON PreparedStatementSummary where
  parseJSON :: Value -> Parser PreparedStatementSummary
parseJSON =
    String
-> (Object -> Parser PreparedStatementSummary)
-> Value
-> Parser PreparedStatementSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PreparedStatementSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> PreparedStatementSummary
PreparedStatementSummary'
            (Maybe POSIX -> Maybe Text -> PreparedStatementSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> PreparedStatementSummary)
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
"LastModifiedTime")
            Parser (Maybe Text -> PreparedStatementSummary)
-> Parser (Maybe Text) -> Parser PreparedStatementSummary
forall (f :: * -> *) a b. Applicative f => 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
"StatementName")
      )

instance Prelude.Hashable PreparedStatementSummary

instance Prelude.NFData PreparedStatementSummary