{-# 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.CodeGuruProfiler.Types.TimestampStructure
-- 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.CodeGuruProfiler.Types.TimestampStructure 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

-- | A data type that contains a @Timestamp@ object. This is specified using
-- the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1
-- millisecond past June 1, 2020 1:15:02 PM UTC.
--
-- /See:/ 'newTimestampStructure' smart constructor.
data TimestampStructure = TimestampStructure'
  { -- | A @Timestamp@. This is specified using the ISO 8601 format. For example,
    -- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
    -- 1:15:02 PM UTC.
    TimestampStructure -> ISO8601
value :: Data.ISO8601
  }
  deriving (TimestampStructure -> TimestampStructure -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestampStructure -> TimestampStructure -> Bool
$c/= :: TimestampStructure -> TimestampStructure -> Bool
== :: TimestampStructure -> TimestampStructure -> Bool
$c== :: TimestampStructure -> TimestampStructure -> Bool
Prelude.Eq, ReadPrec [TimestampStructure]
ReadPrec TimestampStructure
Int -> ReadS TimestampStructure
ReadS [TimestampStructure]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestampStructure]
$creadListPrec :: ReadPrec [TimestampStructure]
readPrec :: ReadPrec TimestampStructure
$creadPrec :: ReadPrec TimestampStructure
readList :: ReadS [TimestampStructure]
$creadList :: ReadS [TimestampStructure]
readsPrec :: Int -> ReadS TimestampStructure
$creadsPrec :: Int -> ReadS TimestampStructure
Prelude.Read, Int -> TimestampStructure -> ShowS
[TimestampStructure] -> ShowS
TimestampStructure -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestampStructure] -> ShowS
$cshowList :: [TimestampStructure] -> ShowS
show :: TimestampStructure -> String
$cshow :: TimestampStructure -> String
showsPrec :: Int -> TimestampStructure -> ShowS
$cshowsPrec :: Int -> TimestampStructure -> ShowS
Prelude.Show, forall x. Rep TimestampStructure x -> TimestampStructure
forall x. TimestampStructure -> Rep TimestampStructure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestampStructure x -> TimestampStructure
$cfrom :: forall x. TimestampStructure -> Rep TimestampStructure x
Prelude.Generic)

-- |
-- Create a value of 'TimestampStructure' 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:
--
-- 'value', 'timestampStructure_value' - A @Timestamp@. This is specified using the ISO 8601 format. For example,
-- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
-- 1:15:02 PM UTC.
newTimestampStructure ::
  -- | 'value'
  Prelude.UTCTime ->
  TimestampStructure
newTimestampStructure :: UTCTime -> TimestampStructure
newTimestampStructure UTCTime
pValue_ =
  TimestampStructure'
    { $sel:value:TimestampStructure' :: ISO8601
value =
        forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pValue_
    }

-- | A @Timestamp@. This is specified using the ISO 8601 format. For example,
-- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
-- 1:15:02 PM UTC.
timestampStructure_value :: Lens.Lens' TimestampStructure Prelude.UTCTime
timestampStructure_value :: Lens' TimestampStructure UTCTime
timestampStructure_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestampStructure' {ISO8601
value :: ISO8601
$sel:value:TimestampStructure' :: TimestampStructure -> ISO8601
value} -> ISO8601
value) (\s :: TimestampStructure
s@TimestampStructure' {} ISO8601
a -> TimestampStructure
s {$sel:value:TimestampStructure' :: ISO8601
value = ISO8601
a} :: TimestampStructure) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON TimestampStructure where
  parseJSON :: Value -> Parser TimestampStructure
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimestampStructure"
      ( \Object
x ->
          ISO8601 -> TimestampStructure
TimestampStructure' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"value")
      )

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

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