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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Forecast.Types.PredictorExecution
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
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]
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
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.
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'
    { $sel:predictorExecutions:PredictorExecutionDetails' :: Maybe (NonEmpty PredictorExecution)
predictorExecutions =
        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 :: Lens'
  PredictorExecutionDetails (Maybe (NonEmpty PredictorExecution))
predictorExecutionDetails_predictorExecutions = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON PredictorExecutionDetails where
  parseJSON :: Value -> Parser PredictorExecutionDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PredictorExecutionDetails"
      ( \Object
x ->
          Maybe (NonEmpty PredictorExecution) -> PredictorExecutionDetails
PredictorExecutionDetails'
            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
"PredictorExecutions")
      )

instance Prelude.Hashable PredictorExecutionDetails where
  hashWithSalt :: Int -> PredictorExecutionDetails -> Int
hashWithSalt Int
_salt PredictorExecutionDetails' {Maybe (NonEmpty PredictorExecution)
predictorExecutions :: Maybe (NonEmpty PredictorExecution)
$sel:predictorExecutions:PredictorExecutionDetails' :: PredictorExecutionDetails -> Maybe (NonEmpty PredictorExecution)
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty PredictorExecution)
predictorExecutions

instance Prelude.NFData PredictorExecutionDetails where
  rnf :: PredictorExecutionDetails -> ()
rnf PredictorExecutionDetails' {Maybe (NonEmpty PredictorExecution)
predictorExecutions :: Maybe (NonEmpty PredictorExecution)
$sel:predictorExecutions:PredictorExecutionDetails' :: PredictorExecutionDetails -> Maybe (NonEmpty PredictorExecution)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty PredictorExecution)
predictorExecutions