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

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

-- | The time range of a cost estimation.
--
-- /See:/ 'newCostEstimationTimeRange' smart constructor.
data CostEstimationTimeRange = CostEstimationTimeRange'
  { -- | The start time of the cost estimation.
    CostEstimationTimeRange -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The end time of the cost estimation.
    CostEstimationTimeRange -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX
  }
  deriving (CostEstimationTimeRange -> CostEstimationTimeRange -> Bool
(CostEstimationTimeRange -> CostEstimationTimeRange -> Bool)
-> (CostEstimationTimeRange -> CostEstimationTimeRange -> Bool)
-> Eq CostEstimationTimeRange
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]
(Int -> ReadS CostEstimationTimeRange)
-> ReadS [CostEstimationTimeRange]
-> ReadPrec CostEstimationTimeRange
-> ReadPrec [CostEstimationTimeRange]
-> Read 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
(Int -> CostEstimationTimeRange -> ShowS)
-> (CostEstimationTimeRange -> String)
-> ([CostEstimationTimeRange] -> ShowS)
-> Show CostEstimationTimeRange
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.
 CostEstimationTimeRange -> Rep CostEstimationTimeRange x)
-> (forall x.
    Rep CostEstimationTimeRange x -> CostEstimationTimeRange)
-> Generic CostEstimationTimeRange
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:
--
-- 'startTime', 'costEstimationTimeRange_startTime' - The start time of the cost estimation.
--
-- 'endTime', 'costEstimationTimeRange_endTime' - The end time of the cost estimation.
newCostEstimationTimeRange ::
  CostEstimationTimeRange
newCostEstimationTimeRange :: CostEstimationTimeRange
newCostEstimationTimeRange =
  CostEstimationTimeRange' :: Maybe POSIX -> Maybe POSIX -> CostEstimationTimeRange
CostEstimationTimeRange'
    { $sel:startTime:CostEstimationTimeRange' :: Maybe POSIX
startTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:CostEstimationTimeRange' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The start time of the cost estimation.
costEstimationTimeRange_startTime :: Lens.Lens' CostEstimationTimeRange (Prelude.Maybe Prelude.UTCTime)
costEstimationTimeRange_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CostEstimationTimeRange -> f CostEstimationTimeRange
costEstimationTimeRange_startTime = (CostEstimationTimeRange -> Maybe POSIX)
-> (CostEstimationTimeRange
    -> Maybe POSIX -> CostEstimationTimeRange)
-> Lens
     CostEstimationTimeRange
     CostEstimationTimeRange
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> CostEstimationTimeRange -> f CostEstimationTimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CostEstimationTimeRange
-> f CostEstimationTimeRange
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 end time of the cost estimation.
costEstimationTimeRange_endTime :: Lens.Lens' CostEstimationTimeRange (Prelude.Maybe Prelude.UTCTime)
costEstimationTimeRange_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CostEstimationTimeRange -> f CostEstimationTimeRange
costEstimationTimeRange_endTime = (CostEstimationTimeRange -> Maybe POSIX)
-> (CostEstimationTimeRange
    -> Maybe POSIX -> CostEstimationTimeRange)
-> Lens
     CostEstimationTimeRange
     CostEstimationTimeRange
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> CostEstimationTimeRange -> f CostEstimationTimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CostEstimationTimeRange
-> f CostEstimationTimeRange
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

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

instance Prelude.Hashable CostEstimationTimeRange

instance Prelude.NFData CostEstimationTimeRange