{-# 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.Forecast.Types.WhatIfForecastSummary
-- 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.Forecast.Types.WhatIfForecastSummary 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

-- | Provides a summary of the what-if forecast properties used in the
-- ListWhatIfForecasts operation. To get the complete set of properties,
-- call the DescribeWhatIfForecast operation, and provide the
-- @WhatIfForecastArn@ that is listed in the summary.
--
-- /See:/ 'newWhatIfForecastSummary' smart constructor.
data WhatIfForecastSummary = WhatIfForecastSummary'
  { -- | When the what-if forecast was created.
    WhatIfForecastSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The last time the resource was modified. The timestamp depends on the
    -- status of the job:
    --
    -- -   @CREATE_PENDING@ - The @CreationTime@.
    --
    -- -   @CREATE_IN_PROGRESS@ - The current timestamp.
    --
    -- -   @CREATE_STOPPING@ - The current timestamp.
    --
    -- -   @CREATE_STOPPED@ - When the job stopped.
    --
    -- -   @ACTIVE@ or @CREATE_FAILED@ - When the job finished or failed.
    WhatIfForecastSummary -> Maybe POSIX
lastModificationTime :: Prelude.Maybe Data.POSIX,
    -- | If an error occurred, an informational message about the error.
    WhatIfForecastSummary -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The status of the what-if forecast. States include:
    --
    -- -   @ACTIVE@
    --
    -- -   @CREATE_PENDING@, @CREATE_IN_PROGRESS@, @CREATE_FAILED@
    --
    -- -   @CREATE_STOPPING@, @CREATE_STOPPED@
    --
    -- -   @DELETE_PENDING@, @DELETE_IN_PROGRESS@, @DELETE_FAILED@
    --
    -- The @Status@ of the what-if analysis must be @ACTIVE@ before you can
    -- access the analysis.
    WhatIfForecastSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the what-if analysis that contains
    -- this what-if forecast.
    WhatIfForecastSummary -> Maybe Text
whatIfAnalysisArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the what-if forecast.
    WhatIfForecastSummary -> Maybe Text
whatIfForecastArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the what-if forecast.
    WhatIfForecastSummary -> Maybe Text
whatIfForecastName :: Prelude.Maybe Prelude.Text
  }
  deriving (WhatIfForecastSummary -> WhatIfForecastSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WhatIfForecastSummary -> WhatIfForecastSummary -> Bool
$c/= :: WhatIfForecastSummary -> WhatIfForecastSummary -> Bool
== :: WhatIfForecastSummary -> WhatIfForecastSummary -> Bool
$c== :: WhatIfForecastSummary -> WhatIfForecastSummary -> Bool
Prelude.Eq, ReadPrec [WhatIfForecastSummary]
ReadPrec WhatIfForecastSummary
Int -> ReadS WhatIfForecastSummary
ReadS [WhatIfForecastSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WhatIfForecastSummary]
$creadListPrec :: ReadPrec [WhatIfForecastSummary]
readPrec :: ReadPrec WhatIfForecastSummary
$creadPrec :: ReadPrec WhatIfForecastSummary
readList :: ReadS [WhatIfForecastSummary]
$creadList :: ReadS [WhatIfForecastSummary]
readsPrec :: Int -> ReadS WhatIfForecastSummary
$creadsPrec :: Int -> ReadS WhatIfForecastSummary
Prelude.Read, Int -> WhatIfForecastSummary -> ShowS
[WhatIfForecastSummary] -> ShowS
WhatIfForecastSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WhatIfForecastSummary] -> ShowS
$cshowList :: [WhatIfForecastSummary] -> ShowS
show :: WhatIfForecastSummary -> String
$cshow :: WhatIfForecastSummary -> String
showsPrec :: Int -> WhatIfForecastSummary -> ShowS
$cshowsPrec :: Int -> WhatIfForecastSummary -> ShowS
Prelude.Show, forall x. Rep WhatIfForecastSummary x -> WhatIfForecastSummary
forall x. WhatIfForecastSummary -> Rep WhatIfForecastSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WhatIfForecastSummary x -> WhatIfForecastSummary
$cfrom :: forall x. WhatIfForecastSummary -> Rep WhatIfForecastSummary x
Prelude.Generic)

-- |
-- Create a value of 'WhatIfForecastSummary' 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:
--
-- 'creationTime', 'whatIfForecastSummary_creationTime' - When the what-if forecast was created.
--
-- 'lastModificationTime', 'whatIfForecastSummary_lastModificationTime' - The last time the resource was modified. The timestamp depends on the
-- status of the job:
--
-- -   @CREATE_PENDING@ - The @CreationTime@.
--
-- -   @CREATE_IN_PROGRESS@ - The current timestamp.
--
-- -   @CREATE_STOPPING@ - The current timestamp.
--
-- -   @CREATE_STOPPED@ - When the job stopped.
--
-- -   @ACTIVE@ or @CREATE_FAILED@ - When the job finished or failed.
--
-- 'message', 'whatIfForecastSummary_message' - If an error occurred, an informational message about the error.
--
-- 'status', 'whatIfForecastSummary_status' - The status of the what-if forecast. States include:
--
-- -   @ACTIVE@
--
-- -   @CREATE_PENDING@, @CREATE_IN_PROGRESS@, @CREATE_FAILED@
--
-- -   @CREATE_STOPPING@, @CREATE_STOPPED@
--
-- -   @DELETE_PENDING@, @DELETE_IN_PROGRESS@, @DELETE_FAILED@
--
-- The @Status@ of the what-if analysis must be @ACTIVE@ before you can
-- access the analysis.
--
-- 'whatIfAnalysisArn', 'whatIfForecastSummary_whatIfAnalysisArn' - The Amazon Resource Name (ARN) of the what-if analysis that contains
-- this what-if forecast.
--
-- 'whatIfForecastArn', 'whatIfForecastSummary_whatIfForecastArn' - The Amazon Resource Name (ARN) of the what-if forecast.
--
-- 'whatIfForecastName', 'whatIfForecastSummary_whatIfForecastName' - The name of the what-if forecast.
newWhatIfForecastSummary ::
  WhatIfForecastSummary
newWhatIfForecastSummary :: WhatIfForecastSummary
newWhatIfForecastSummary =
  WhatIfForecastSummary'
    { $sel:creationTime:WhatIfForecastSummary' :: Maybe POSIX
creationTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastModificationTime:WhatIfForecastSummary' :: Maybe POSIX
lastModificationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:message:WhatIfForecastSummary' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:status:WhatIfForecastSummary' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:whatIfAnalysisArn:WhatIfForecastSummary' :: Maybe Text
whatIfAnalysisArn = forall a. Maybe a
Prelude.Nothing,
      $sel:whatIfForecastArn:WhatIfForecastSummary' :: Maybe Text
whatIfForecastArn = forall a. Maybe a
Prelude.Nothing,
      $sel:whatIfForecastName:WhatIfForecastSummary' :: Maybe Text
whatIfForecastName = forall a. Maybe a
Prelude.Nothing
    }

-- | When the what-if forecast was created.
whatIfForecastSummary_creationTime :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.UTCTime)
whatIfForecastSummary_creationTime :: Lens' WhatIfForecastSummary (Maybe UTCTime)
whatIfForecastSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe POSIX
a -> WhatIfForecastSummary
s {$sel:creationTime:WhatIfForecastSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: WhatIfForecastSummary) 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 last time the resource was modified. The timestamp depends on the
-- status of the job:
--
-- -   @CREATE_PENDING@ - The @CreationTime@.
--
-- -   @CREATE_IN_PROGRESS@ - The current timestamp.
--
-- -   @CREATE_STOPPING@ - The current timestamp.
--
-- -   @CREATE_STOPPED@ - When the job stopped.
--
-- -   @ACTIVE@ or @CREATE_FAILED@ - When the job finished or failed.
whatIfForecastSummary_lastModificationTime :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.UTCTime)
whatIfForecastSummary_lastModificationTime :: Lens' WhatIfForecastSummary (Maybe UTCTime)
whatIfForecastSummary_lastModificationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe POSIX
lastModificationTime :: Maybe POSIX
$sel:lastModificationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
lastModificationTime} -> Maybe POSIX
lastModificationTime) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe POSIX
a -> WhatIfForecastSummary
s {$sel:lastModificationTime:WhatIfForecastSummary' :: Maybe POSIX
lastModificationTime = Maybe POSIX
a} :: WhatIfForecastSummary) 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

-- | If an error occurred, an informational message about the error.
whatIfForecastSummary_message :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.Text)
whatIfForecastSummary_message :: Lens' WhatIfForecastSummary (Maybe Text)
whatIfForecastSummary_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe Text
message :: Maybe Text
$sel:message:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
message} -> Maybe Text
message) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe Text
a -> WhatIfForecastSummary
s {$sel:message:WhatIfForecastSummary' :: Maybe Text
message = Maybe Text
a} :: WhatIfForecastSummary)

-- | The status of the what-if forecast. States include:
--
-- -   @ACTIVE@
--
-- -   @CREATE_PENDING@, @CREATE_IN_PROGRESS@, @CREATE_FAILED@
--
-- -   @CREATE_STOPPING@, @CREATE_STOPPED@
--
-- -   @DELETE_PENDING@, @DELETE_IN_PROGRESS@, @DELETE_FAILED@
--
-- The @Status@ of the what-if analysis must be @ACTIVE@ before you can
-- access the analysis.
whatIfForecastSummary_status :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.Text)
whatIfForecastSummary_status :: Lens' WhatIfForecastSummary (Maybe Text)
whatIfForecastSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe Text
status :: Maybe Text
$sel:status:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe Text
a -> WhatIfForecastSummary
s {$sel:status:WhatIfForecastSummary' :: Maybe Text
status = Maybe Text
a} :: WhatIfForecastSummary)

-- | The Amazon Resource Name (ARN) of the what-if analysis that contains
-- this what-if forecast.
whatIfForecastSummary_whatIfAnalysisArn :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.Text)
whatIfForecastSummary_whatIfAnalysisArn :: Lens' WhatIfForecastSummary (Maybe Text)
whatIfForecastSummary_whatIfAnalysisArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe Text
whatIfAnalysisArn :: Maybe Text
$sel:whatIfAnalysisArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
whatIfAnalysisArn} -> Maybe Text
whatIfAnalysisArn) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe Text
a -> WhatIfForecastSummary
s {$sel:whatIfAnalysisArn:WhatIfForecastSummary' :: Maybe Text
whatIfAnalysisArn = Maybe Text
a} :: WhatIfForecastSummary)

-- | The Amazon Resource Name (ARN) of the what-if forecast.
whatIfForecastSummary_whatIfForecastArn :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.Text)
whatIfForecastSummary_whatIfForecastArn :: Lens' WhatIfForecastSummary (Maybe Text)
whatIfForecastSummary_whatIfForecastArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe Text
whatIfForecastArn :: Maybe Text
$sel:whatIfForecastArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
whatIfForecastArn} -> Maybe Text
whatIfForecastArn) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe Text
a -> WhatIfForecastSummary
s {$sel:whatIfForecastArn:WhatIfForecastSummary' :: Maybe Text
whatIfForecastArn = Maybe Text
a} :: WhatIfForecastSummary)

-- | The name of the what-if forecast.
whatIfForecastSummary_whatIfForecastName :: Lens.Lens' WhatIfForecastSummary (Prelude.Maybe Prelude.Text)
whatIfForecastSummary_whatIfForecastName :: Lens' WhatIfForecastSummary (Maybe Text)
whatIfForecastSummary_whatIfForecastName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WhatIfForecastSummary' {Maybe Text
whatIfForecastName :: Maybe Text
$sel:whatIfForecastName:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
whatIfForecastName} -> Maybe Text
whatIfForecastName) (\s :: WhatIfForecastSummary
s@WhatIfForecastSummary' {} Maybe Text
a -> WhatIfForecastSummary
s {$sel:whatIfForecastName:WhatIfForecastSummary' :: Maybe Text
whatIfForecastName = Maybe Text
a} :: WhatIfForecastSummary)

instance Data.FromJSON WhatIfForecastSummary where
  parseJSON :: Value -> Parser WhatIfForecastSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WhatIfForecastSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> WhatIfForecastSummary
WhatIfForecastSummary'
            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
"CreationTime")
            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
"LastModificationTime")
            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
"Message")
            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
"Status")
            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
"WhatIfAnalysisArn")
            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
"WhatIfForecastArn")
            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
"WhatIfForecastName")
      )

instance Prelude.Hashable WhatIfForecastSummary where
  hashWithSalt :: Int -> WhatIfForecastSummary -> Int
hashWithSalt Int
_salt WhatIfForecastSummary' {Maybe Text
Maybe POSIX
whatIfForecastName :: Maybe Text
whatIfForecastArn :: Maybe Text
whatIfAnalysisArn :: Maybe Text
status :: Maybe Text
message :: Maybe Text
lastModificationTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:whatIfForecastName:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:whatIfForecastArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:whatIfAnalysisArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:status:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:message:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:lastModificationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
$sel:creationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModificationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
whatIfAnalysisArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
whatIfForecastArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
whatIfForecastName

instance Prelude.NFData WhatIfForecastSummary where
  rnf :: WhatIfForecastSummary -> ()
rnf WhatIfForecastSummary' {Maybe Text
Maybe POSIX
whatIfForecastName :: Maybe Text
whatIfForecastArn :: Maybe Text
whatIfAnalysisArn :: Maybe Text
status :: Maybe Text
message :: Maybe Text
lastModificationTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:whatIfForecastName:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:whatIfForecastArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:whatIfAnalysisArn:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:status:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:message:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe Text
$sel:lastModificationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
$sel:creationTime:WhatIfForecastSummary' :: WhatIfForecastSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModificationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
whatIfAnalysisArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
whatIfForecastArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
whatIfForecastName