{-# 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.LookoutMetrics.Types.BackTestConfiguration
-- 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.LookoutMetrics.Types.BackTestConfiguration 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

-- | Settings for backtest mode.
--
-- /See:/ 'newBackTestConfiguration' smart constructor.
data BackTestConfiguration = BackTestConfiguration'
  { -- | Run a backtest instead of monitoring new data.
    BackTestConfiguration -> Bool
runBackTestMode :: Prelude.Bool
  }
  deriving (BackTestConfiguration -> BackTestConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackTestConfiguration -> BackTestConfiguration -> Bool
$c/= :: BackTestConfiguration -> BackTestConfiguration -> Bool
== :: BackTestConfiguration -> BackTestConfiguration -> Bool
$c== :: BackTestConfiguration -> BackTestConfiguration -> Bool
Prelude.Eq, ReadPrec [BackTestConfiguration]
ReadPrec BackTestConfiguration
Int -> ReadS BackTestConfiguration
ReadS [BackTestConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackTestConfiguration]
$creadListPrec :: ReadPrec [BackTestConfiguration]
readPrec :: ReadPrec BackTestConfiguration
$creadPrec :: ReadPrec BackTestConfiguration
readList :: ReadS [BackTestConfiguration]
$creadList :: ReadS [BackTestConfiguration]
readsPrec :: Int -> ReadS BackTestConfiguration
$creadsPrec :: Int -> ReadS BackTestConfiguration
Prelude.Read, Int -> BackTestConfiguration -> ShowS
[BackTestConfiguration] -> ShowS
BackTestConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackTestConfiguration] -> ShowS
$cshowList :: [BackTestConfiguration] -> ShowS
show :: BackTestConfiguration -> String
$cshow :: BackTestConfiguration -> String
showsPrec :: Int -> BackTestConfiguration -> ShowS
$cshowsPrec :: Int -> BackTestConfiguration -> ShowS
Prelude.Show, forall x. Rep BackTestConfiguration x -> BackTestConfiguration
forall x. BackTestConfiguration -> Rep BackTestConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackTestConfiguration x -> BackTestConfiguration
$cfrom :: forall x. BackTestConfiguration -> Rep BackTestConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'BackTestConfiguration' 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:
--
-- 'runBackTestMode', 'backTestConfiguration_runBackTestMode' - Run a backtest instead of monitoring new data.
newBackTestConfiguration ::
  -- | 'runBackTestMode'
  Prelude.Bool ->
  BackTestConfiguration
newBackTestConfiguration :: Bool -> BackTestConfiguration
newBackTestConfiguration Bool
pRunBackTestMode_ =
  BackTestConfiguration'
    { $sel:runBackTestMode:BackTestConfiguration' :: Bool
runBackTestMode =
        Bool
pRunBackTestMode_
    }

-- | Run a backtest instead of monitoring new data.
backTestConfiguration_runBackTestMode :: Lens.Lens' BackTestConfiguration Prelude.Bool
backTestConfiguration_runBackTestMode :: Lens' BackTestConfiguration Bool
backTestConfiguration_runBackTestMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackTestConfiguration' {Bool
runBackTestMode :: Bool
$sel:runBackTestMode:BackTestConfiguration' :: BackTestConfiguration -> Bool
runBackTestMode} -> Bool
runBackTestMode) (\s :: BackTestConfiguration
s@BackTestConfiguration' {} Bool
a -> BackTestConfiguration
s {$sel:runBackTestMode:BackTestConfiguration' :: Bool
runBackTestMode = Bool
a} :: BackTestConfiguration)

instance Data.FromJSON BackTestConfiguration where
  parseJSON :: Value -> Parser BackTestConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BackTestConfiguration"
      ( \Object
x ->
          Bool -> BackTestConfiguration
BackTestConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RunBackTestMode")
      )

instance Prelude.Hashable BackTestConfiguration where
  hashWithSalt :: Int -> BackTestConfiguration -> Int
hashWithSalt Int
_salt BackTestConfiguration' {Bool
runBackTestMode :: Bool
$sel:runBackTestMode:BackTestConfiguration' :: BackTestConfiguration -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
runBackTestMode

instance Prelude.NFData BackTestConfiguration where
  rnf :: BackTestConfiguration -> ()
rnf BackTestConfiguration' {Bool
runBackTestMode :: Bool
$sel:runBackTestMode:BackTestConfiguration' :: BackTestConfiguration -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
runBackTestMode

instance Data.ToJSON BackTestConfiguration where
  toJSON :: BackTestConfiguration -> Value
toJSON BackTestConfiguration' {Bool
runBackTestMode :: Bool
$sel:runBackTestMode:BackTestConfiguration' :: BackTestConfiguration -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"RunBackTestMode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
runBackTestMode)
          ]
      )