{-# 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.Detective.Types.TimestampForCollection
-- 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.Detective.Types.TimestampForCollection 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

-- | Details on when data collection began for a source package.
--
-- /See:/ 'newTimestampForCollection' smart constructor.
data TimestampForCollection = TimestampForCollection'
  { -- | The data and time when data collection began for a source package. The
    -- value is an ISO8601 formatted string. For example,
    -- @2021-08-18T16:35:56.284Z@.
    TimestampForCollection -> Maybe ISO8601
timestamp :: Prelude.Maybe Data.ISO8601
  }
  deriving (TimestampForCollection -> TimestampForCollection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestampForCollection -> TimestampForCollection -> Bool
$c/= :: TimestampForCollection -> TimestampForCollection -> Bool
== :: TimestampForCollection -> TimestampForCollection -> Bool
$c== :: TimestampForCollection -> TimestampForCollection -> Bool
Prelude.Eq, ReadPrec [TimestampForCollection]
ReadPrec TimestampForCollection
Int -> ReadS TimestampForCollection
ReadS [TimestampForCollection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestampForCollection]
$creadListPrec :: ReadPrec [TimestampForCollection]
readPrec :: ReadPrec TimestampForCollection
$creadPrec :: ReadPrec TimestampForCollection
readList :: ReadS [TimestampForCollection]
$creadList :: ReadS [TimestampForCollection]
readsPrec :: Int -> ReadS TimestampForCollection
$creadsPrec :: Int -> ReadS TimestampForCollection
Prelude.Read, Int -> TimestampForCollection -> ShowS
[TimestampForCollection] -> ShowS
TimestampForCollection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestampForCollection] -> ShowS
$cshowList :: [TimestampForCollection] -> ShowS
show :: TimestampForCollection -> String
$cshow :: TimestampForCollection -> String
showsPrec :: Int -> TimestampForCollection -> ShowS
$cshowsPrec :: Int -> TimestampForCollection -> ShowS
Prelude.Show, forall x. Rep TimestampForCollection x -> TimestampForCollection
forall x. TimestampForCollection -> Rep TimestampForCollection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestampForCollection x -> TimestampForCollection
$cfrom :: forall x. TimestampForCollection -> Rep TimestampForCollection x
Prelude.Generic)

-- |
-- Create a value of 'TimestampForCollection' 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:
--
-- 'timestamp', 'timestampForCollection_timestamp' - The data and time when data collection began for a source package. The
-- value is an ISO8601 formatted string. For example,
-- @2021-08-18T16:35:56.284Z@.
newTimestampForCollection ::
  TimestampForCollection
newTimestampForCollection :: TimestampForCollection
newTimestampForCollection =
  TimestampForCollection'
    { $sel:timestamp:TimestampForCollection' :: Maybe ISO8601
timestamp =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The data and time when data collection began for a source package. The
-- value is an ISO8601 formatted string. For example,
-- @2021-08-18T16:35:56.284Z@.
timestampForCollection_timestamp :: Lens.Lens' TimestampForCollection (Prelude.Maybe Prelude.UTCTime)
timestampForCollection_timestamp :: Lens' TimestampForCollection (Maybe UTCTime)
timestampForCollection_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestampForCollection' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:TimestampForCollection' :: TimestampForCollection -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: TimestampForCollection
s@TimestampForCollection' {} Maybe ISO8601
a -> TimestampForCollection
s {$sel:timestamp:TimestampForCollection' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: TimestampForCollection) 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

instance Data.FromJSON TimestampForCollection where
  parseJSON :: Value -> Parser TimestampForCollection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimestampForCollection"
      ( \Object
x ->
          Maybe ISO8601 -> TimestampForCollection
TimestampForCollection'
            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
"Timestamp")
      )

instance Prelude.Hashable TimestampForCollection where
  hashWithSalt :: Int -> TimestampForCollection -> Int
hashWithSalt Int
_salt TimestampForCollection' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:TimestampForCollection' :: TimestampForCollection -> Maybe ISO8601
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
timestamp

instance Prelude.NFData TimestampForCollection where
  rnf :: TimestampForCollection -> ()
rnf TimestampForCollection' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:TimestampForCollection' :: TimestampForCollection -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
timestamp