{-# 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.ProfileTime
-- 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.ProfileTime 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 start time of a profile.
--
-- /See:/ 'newProfileTime' smart constructor.
data ProfileTime = ProfileTime'
  { -- | The start time of a profile. It 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.
    ProfileTime -> Maybe ISO8601
start :: Prelude.Maybe Data.ISO8601
  }
  deriving (ProfileTime -> ProfileTime -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfileTime -> ProfileTime -> Bool
$c/= :: ProfileTime -> ProfileTime -> Bool
== :: ProfileTime -> ProfileTime -> Bool
$c== :: ProfileTime -> ProfileTime -> Bool
Prelude.Eq, ReadPrec [ProfileTime]
ReadPrec ProfileTime
Int -> ReadS ProfileTime
ReadS [ProfileTime]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProfileTime]
$creadListPrec :: ReadPrec [ProfileTime]
readPrec :: ReadPrec ProfileTime
$creadPrec :: ReadPrec ProfileTime
readList :: ReadS [ProfileTime]
$creadList :: ReadS [ProfileTime]
readsPrec :: Int -> ReadS ProfileTime
$creadsPrec :: Int -> ReadS ProfileTime
Prelude.Read, Int -> ProfileTime -> ShowS
[ProfileTime] -> ShowS
ProfileTime -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProfileTime] -> ShowS
$cshowList :: [ProfileTime] -> ShowS
show :: ProfileTime -> String
$cshow :: ProfileTime -> String
showsPrec :: Int -> ProfileTime -> ShowS
$cshowsPrec :: Int -> ProfileTime -> ShowS
Prelude.Show, forall x. Rep ProfileTime x -> ProfileTime
forall x. ProfileTime -> Rep ProfileTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProfileTime x -> ProfileTime
$cfrom :: forall x. ProfileTime -> Rep ProfileTime x
Prelude.Generic)

-- |
-- Create a value of 'ProfileTime' 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:
--
-- 'start', 'profileTime_start' - The start time of a profile. It 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.
newProfileTime ::
  ProfileTime
newProfileTime :: ProfileTime
newProfileTime =
  ProfileTime' {$sel:start:ProfileTime' :: Maybe ISO8601
start = forall a. Maybe a
Prelude.Nothing}

-- | The start time of a profile. It 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.
profileTime_start :: Lens.Lens' ProfileTime (Prelude.Maybe Prelude.UTCTime)
profileTime_start :: Lens' ProfileTime (Maybe UTCTime)
profileTime_start = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfileTime' {Maybe ISO8601
start :: Maybe ISO8601
$sel:start:ProfileTime' :: ProfileTime -> Maybe ISO8601
start} -> Maybe ISO8601
start) (\s :: ProfileTime
s@ProfileTime' {} Maybe ISO8601
a -> ProfileTime
s {$sel:start:ProfileTime' :: Maybe ISO8601
start = Maybe ISO8601
a} :: ProfileTime) 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 ProfileTime where
  parseJSON :: Value -> Parser ProfileTime
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProfileTime"
      ( \Object
x ->
          Maybe ISO8601 -> ProfileTime
ProfileTime' 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
"start")
      )

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

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