{-# 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.DevOpsGuru.Types.CostEstimationTimeRange
-- 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.DevOpsGuru.Types.CostEstimationTimeRange 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

-- | The time range of a cost estimation.
--
-- /See:/ 'newCostEstimationTimeRange' smart constructor.
data CostEstimationTimeRange = CostEstimationTimeRange'
  { -- | The end time of the cost estimation.
    CostEstimationTimeRange -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The start time of the cost estimation.
    CostEstimationTimeRange -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX
  }
  deriving (CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
$c/= :: CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
== :: CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
$c== :: CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
Prelude.Eq, ReadPrec [CostEstimationTimeRange]
ReadPrec CostEstimationTimeRange
Int -> ReadS CostEstimationTimeRange
ReadS [CostEstimationTimeRange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CostEstimationTimeRange]
$creadListPrec :: ReadPrec [CostEstimationTimeRange]
readPrec :: ReadPrec CostEstimationTimeRange
$creadPrec :: ReadPrec CostEstimationTimeRange
readList :: ReadS [CostEstimationTimeRange]
$creadList :: ReadS [CostEstimationTimeRange]
readsPrec :: Int -> ReadS CostEstimationTimeRange
$creadsPrec :: Int -> ReadS CostEstimationTimeRange
Prelude.Read, Int -> CostEstimationTimeRange -> ShowS
[CostEstimationTimeRange] -> ShowS
CostEstimationTimeRange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostEstimationTimeRange] -> ShowS
$cshowList :: [CostEstimationTimeRange] -> ShowS
show :: CostEstimationTimeRange -> String
$cshow :: CostEstimationTimeRange -> String
showsPrec :: Int -> CostEstimationTimeRange -> ShowS
$cshowsPrec :: Int -> CostEstimationTimeRange -> ShowS
Prelude.Show, forall x. Rep CostEstimationTimeRange x -> CostEstimationTimeRange
forall x. CostEstimationTimeRange -> Rep CostEstimationTimeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CostEstimationTimeRange x -> CostEstimationTimeRange
$cfrom :: forall x. CostEstimationTimeRange -> Rep CostEstimationTimeRange x
Prelude.Generic)

-- |
-- Create a value of 'CostEstimationTimeRange' 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:
--
-- 'endTime', 'costEstimationTimeRange_endTime' - The end time of the cost estimation.
--
-- 'startTime', 'costEstimationTimeRange_startTime' - The start time of the cost estimation.
newCostEstimationTimeRange ::
  CostEstimationTimeRange
newCostEstimationTimeRange :: CostEstimationTimeRange
newCostEstimationTimeRange =
  CostEstimationTimeRange'
    { $sel:endTime:CostEstimationTimeRange' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:CostEstimationTimeRange' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The end time of the cost estimation.
costEstimationTimeRange_endTime :: Lens.Lens' CostEstimationTimeRange (Prelude.Maybe Prelude.UTCTime)
costEstimationTimeRange_endTime :: Lens' CostEstimationTimeRange (Maybe UTCTime)
costEstimationTimeRange_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostEstimationTimeRange' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: CostEstimationTimeRange
s@CostEstimationTimeRange' {} Maybe POSIX
a -> CostEstimationTimeRange
s {$sel:endTime:CostEstimationTimeRange' :: Maybe POSIX
endTime = Maybe POSIX
a} :: CostEstimationTimeRange) 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 start time of the cost estimation.
costEstimationTimeRange_startTime :: Lens.Lens' CostEstimationTimeRange (Prelude.Maybe Prelude.UTCTime)
costEstimationTimeRange_startTime :: Lens' CostEstimationTimeRange (Maybe UTCTime)
costEstimationTimeRange_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostEstimationTimeRange' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: CostEstimationTimeRange
s@CostEstimationTimeRange' {} Maybe POSIX
a -> CostEstimationTimeRange
s {$sel:startTime:CostEstimationTimeRange' :: Maybe POSIX
startTime = Maybe POSIX
a} :: CostEstimationTimeRange) 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 CostEstimationTimeRange where
  parseJSON :: Value -> Parser CostEstimationTimeRange
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CostEstimationTimeRange"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> CostEstimationTimeRange
CostEstimationTimeRange'
            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
"EndTime")
            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
"StartTime")
      )

instance Prelude.Hashable CostEstimationTimeRange where
  hashWithSalt :: Int -> CostEstimationTimeRange -> Int
hashWithSalt Int
_salt CostEstimationTimeRange' {Maybe POSIX
startTime :: Maybe POSIX
endTime :: Maybe POSIX
$sel:startTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
$sel:endTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime

instance Prelude.NFData CostEstimationTimeRange where
  rnf :: CostEstimationTimeRange -> ()
rnf CostEstimationTimeRange' {Maybe POSIX
startTime :: Maybe POSIX
endTime :: Maybe POSIX
$sel:startTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
$sel:endTime:CostEstimationTimeRange' :: CostEstimationTimeRange -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime