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

import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.PredictorExecution
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains details on the backtests performed to evaluate the accuracy of
-- the predictor. The tests are returned in descending order of accuracy,
-- with the most accurate backtest appearing first. You specify the number
-- of backtests to perform when you call the operation.
--
-- /See:/ 'newPredictorExecutionDetails' smart constructor.
data PredictorExecutionDetails = PredictorExecutionDetails'
  { -- | An array of the backtests performed to evaluate the accuracy of the
    -- predictor against a particular algorithm. The @NumberOfBacktestWindows@
    -- from the object determines the number of windows in the array.
    PredictorExecutionDetails -> Maybe (NonEmpty PredictorExecution)
predictorExecutions :: Prelude.Maybe (Prelude.NonEmpty PredictorExecution)
  }
  deriving (PredictorExecutionDetails -> PredictorExecutionDetails -> Bool
(PredictorExecutionDetails -> PredictorExecutionDetails -> Bool)
-> (PredictorExecutionDetails -> PredictorExecutionDetails -> Bool)
-> Eq PredictorExecutionDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredictorExecutionDetails -> PredictorExecutionDetails -> Bool
$c/= :: PredictorExecutionDetails -> PredictorExecutionDetails -> Bool
== :: PredictorExecutionDetails -> PredictorExecutionDetails -> Bool
$c== :: PredictorExecutionDetails -> PredictorExecutionDetails -> Bool
Prelude.Eq, ReadPrec [PredictorExecutionDetails]
ReadPrec PredictorExecutionDetails
Int -> ReadS PredictorExecutionDetails
ReadS [PredictorExecutionDetails]
(Int -> ReadS PredictorExecutionDetails)
-> ReadS [PredictorExecutionDetails]
-> ReadPrec PredictorExecutionDetails
-> ReadPrec [PredictorExecutionDetails]
-> Read PredictorExecutionDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredictorExecutionDetails]
$creadListPrec :: ReadPrec [PredictorExecutionDetails]
readPrec :: ReadPrec PredictorExecutionDetails
$creadPrec :: ReadPrec PredictorExecutionDetails
readList :: ReadS [PredictorExecutionDetails]
$creadList :: ReadS [PredictorExecutionDetails]
readsPrec :: Int -> ReadS PredictorExecutionDetails
$creadsPrec :: Int -> ReadS PredictorExecutionDetails
Prelude.Read, Int -> PredictorExecutionDetails -> ShowS
[PredictorExecutionDetails] -> ShowS
PredictorExecutionDetails -> String
(Int -> PredictorExecutionDetails -> ShowS)
-> (PredictorExecutionDetails -> String)
-> ([PredictorExecutionDetails] -> ShowS)
-> Show PredictorExecutionDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredictorExecutionDetails] -> ShowS
$cshowList :: [PredictorExecutionDetails] -> ShowS
show :: PredictorExecutionDetails -> String
$cshow :: PredictorExecutionDetails -> String
showsPrec :: Int -> PredictorExecutionDetails -> ShowS
$cshowsPrec :: Int -> PredictorExecutionDetails -> ShowS
Prelude.Show, (forall x.
 PredictorExecutionDetails -> Rep PredictorExecutionDetails x)
-> (forall x.
    Rep PredictorExecutionDetails x -> PredictorExecutionDetails)
-> Generic PredictorExecutionDetails
forall x.
Rep PredictorExecutionDetails x -> PredictorExecutionDetails
forall x.
PredictorExecutionDetails -> Rep PredictorExecutionDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredictorExecutionDetails x -> PredictorExecutionDetails
$cfrom :: forall x.
PredictorExecutionDetails -> Rep PredictorExecutionDetails x
Prelude.Generic)

-- |
-- Create a value of 'PredictorExecutionDetails' 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:
--
-- 'predictorExecutions', 'predictorExecutionDetails_predictorExecutions' - An array of the backtests performed to evaluate the accuracy of the
-- predictor against a particular algorithm. The @NumberOfBacktestWindows@
-- from the object determines the number of windows in the array.
newPredictorExecutionDetails ::
  PredictorExecutionDetails
newPredictorExecutionDetails :: PredictorExecutionDetails
newPredictorExecutionDetails =
  PredictorExecutionDetails' :: Maybe (NonEmpty PredictorExecution) -> PredictorExecutionDetails
PredictorExecutionDetails'
    { $sel:predictorExecutions:PredictorExecutionDetails' :: Maybe (NonEmpty PredictorExecution)
predictorExecutions =
        Maybe (NonEmpty PredictorExecution)
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of the backtests performed to evaluate the accuracy of the
-- predictor against a particular algorithm. The @NumberOfBacktestWindows@
-- from the object determines the number of windows in the array.
predictorExecutionDetails_predictorExecutions :: Lens.Lens' PredictorExecutionDetails (Prelude.Maybe (Prelude.NonEmpty PredictorExecution))
predictorExecutionDetails_predictorExecutions :: (Maybe (NonEmpty PredictorExecution)
 -> f (Maybe (NonEmpty PredictorExecution)))
-> PredictorExecutionDetails -> f PredictorExecutionDetails
predictorExecutionDetails_predictorExecutions = (PredictorExecutionDetails -> Maybe (NonEmpty PredictorExecution))
-> (PredictorExecutionDetails
    -> Maybe (NonEmpty PredictorExecution)
    -> PredictorExecutionDetails)
-> Lens
     PredictorExecutionDetails
     PredictorExecutionDetails
     (Maybe (NonEmpty PredictorExecution))
     (Maybe (NonEmpty PredictorExecution))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictorExecutionDetails' {Maybe (NonEmpty PredictorExecution)
predictorExecutions :: Maybe (NonEmpty PredictorExecution)
$sel:predictorExecutions:PredictorExecutionDetails' :: PredictorExecutionDetails -> Maybe (NonEmpty PredictorExecution)
predictorExecutions} -> Maybe (NonEmpty PredictorExecution)
predictorExecutions) (\s :: PredictorExecutionDetails
s@PredictorExecutionDetails' {} Maybe (NonEmpty PredictorExecution)
a -> PredictorExecutionDetails
s {$sel:predictorExecutions:PredictorExecutionDetails' :: Maybe (NonEmpty PredictorExecution)
predictorExecutions = Maybe (NonEmpty PredictorExecution)
a} :: PredictorExecutionDetails) ((Maybe (NonEmpty PredictorExecution)
  -> f (Maybe (NonEmpty PredictorExecution)))
 -> PredictorExecutionDetails -> f PredictorExecutionDetails)
-> ((Maybe (NonEmpty PredictorExecution)
     -> f (Maybe (NonEmpty PredictorExecution)))
    -> Maybe (NonEmpty PredictorExecution)
    -> f (Maybe (NonEmpty PredictorExecution)))
-> (Maybe (NonEmpty PredictorExecution)
    -> f (Maybe (NonEmpty PredictorExecution)))
-> PredictorExecutionDetails
-> f PredictorExecutionDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
-> Iso
     (Maybe (NonEmpty PredictorExecution))
     (Maybe (NonEmpty PredictorExecution))
     (Maybe (NonEmpty PredictorExecution))
     (Maybe (NonEmpty PredictorExecution))
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
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
  (NonEmpty PredictorExecution)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PredictorExecutionDetails where
  parseJSON :: Value -> Parser PredictorExecutionDetails
parseJSON =
    String
-> (Object -> Parser PredictorExecutionDetails)
-> Value
-> Parser PredictorExecutionDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PredictorExecutionDetails"
      ( \Object
x ->
          Maybe (NonEmpty PredictorExecution) -> PredictorExecutionDetails
PredictorExecutionDetails'
            (Maybe (NonEmpty PredictorExecution) -> PredictorExecutionDetails)
-> Parser (Maybe (NonEmpty PredictorExecution))
-> Parser PredictorExecutionDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty PredictorExecution))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictorExecutions")
      )

instance Prelude.Hashable PredictorExecutionDetails

instance Prelude.NFData PredictorExecutionDetails