{-# 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.FraudDetector.Types.TFITrainingMetricsValue
-- 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.FraudDetector.Types.TFITrainingMetricsValue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types.TFIMetricDataPoint
import Amazonka.FraudDetector.Types.TFIModelPerformance
import qualified Amazonka.Prelude as Prelude

-- | The Transaction Fraud Insights (TFI) model training metric details.
--
-- /See:/ 'newTFITrainingMetricsValue' smart constructor.
data TFITrainingMetricsValue = TFITrainingMetricsValue'
  { -- | The model\'s performance metrics data points.
    TFITrainingMetricsValue -> Maybe [TFIMetricDataPoint]
metricDataPoints :: Prelude.Maybe [TFIMetricDataPoint],
    -- | The model performance score.
    TFITrainingMetricsValue -> Maybe TFIModelPerformance
modelPerformance :: Prelude.Maybe TFIModelPerformance
  }
  deriving (TFITrainingMetricsValue -> TFITrainingMetricsValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TFITrainingMetricsValue -> TFITrainingMetricsValue -> Bool
$c/= :: TFITrainingMetricsValue -> TFITrainingMetricsValue -> Bool
== :: TFITrainingMetricsValue -> TFITrainingMetricsValue -> Bool
$c== :: TFITrainingMetricsValue -> TFITrainingMetricsValue -> Bool
Prelude.Eq, ReadPrec [TFITrainingMetricsValue]
ReadPrec TFITrainingMetricsValue
Int -> ReadS TFITrainingMetricsValue
ReadS [TFITrainingMetricsValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TFITrainingMetricsValue]
$creadListPrec :: ReadPrec [TFITrainingMetricsValue]
readPrec :: ReadPrec TFITrainingMetricsValue
$creadPrec :: ReadPrec TFITrainingMetricsValue
readList :: ReadS [TFITrainingMetricsValue]
$creadList :: ReadS [TFITrainingMetricsValue]
readsPrec :: Int -> ReadS TFITrainingMetricsValue
$creadsPrec :: Int -> ReadS TFITrainingMetricsValue
Prelude.Read, Int -> TFITrainingMetricsValue -> ShowS
[TFITrainingMetricsValue] -> ShowS
TFITrainingMetricsValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TFITrainingMetricsValue] -> ShowS
$cshowList :: [TFITrainingMetricsValue] -> ShowS
show :: TFITrainingMetricsValue -> String
$cshow :: TFITrainingMetricsValue -> String
showsPrec :: Int -> TFITrainingMetricsValue -> ShowS
$cshowsPrec :: Int -> TFITrainingMetricsValue -> ShowS
Prelude.Show, forall x. Rep TFITrainingMetricsValue x -> TFITrainingMetricsValue
forall x. TFITrainingMetricsValue -> Rep TFITrainingMetricsValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TFITrainingMetricsValue x -> TFITrainingMetricsValue
$cfrom :: forall x. TFITrainingMetricsValue -> Rep TFITrainingMetricsValue x
Prelude.Generic)

-- |
-- Create a value of 'TFITrainingMetricsValue' 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:
--
-- 'metricDataPoints', 'tFITrainingMetricsValue_metricDataPoints' - The model\'s performance metrics data points.
--
-- 'modelPerformance', 'tFITrainingMetricsValue_modelPerformance' - The model performance score.
newTFITrainingMetricsValue ::
  TFITrainingMetricsValue
newTFITrainingMetricsValue :: TFITrainingMetricsValue
newTFITrainingMetricsValue =
  TFITrainingMetricsValue'
    { $sel:metricDataPoints:TFITrainingMetricsValue' :: Maybe [TFIMetricDataPoint]
metricDataPoints =
        forall a. Maybe a
Prelude.Nothing,
      $sel:modelPerformance:TFITrainingMetricsValue' :: Maybe TFIModelPerformance
modelPerformance = forall a. Maybe a
Prelude.Nothing
    }

-- | The model\'s performance metrics data points.
tFITrainingMetricsValue_metricDataPoints :: Lens.Lens' TFITrainingMetricsValue (Prelude.Maybe [TFIMetricDataPoint])
tFITrainingMetricsValue_metricDataPoints :: Lens' TFITrainingMetricsValue (Maybe [TFIMetricDataPoint])
tFITrainingMetricsValue_metricDataPoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFITrainingMetricsValue' {Maybe [TFIMetricDataPoint]
metricDataPoints :: Maybe [TFIMetricDataPoint]
$sel:metricDataPoints:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe [TFIMetricDataPoint]
metricDataPoints} -> Maybe [TFIMetricDataPoint]
metricDataPoints) (\s :: TFITrainingMetricsValue
s@TFITrainingMetricsValue' {} Maybe [TFIMetricDataPoint]
a -> TFITrainingMetricsValue
s {$sel:metricDataPoints:TFITrainingMetricsValue' :: Maybe [TFIMetricDataPoint]
metricDataPoints = Maybe [TFIMetricDataPoint]
a} :: TFITrainingMetricsValue) 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

-- | The model performance score.
tFITrainingMetricsValue_modelPerformance :: Lens.Lens' TFITrainingMetricsValue (Prelude.Maybe TFIModelPerformance)
tFITrainingMetricsValue_modelPerformance :: Lens' TFITrainingMetricsValue (Maybe TFIModelPerformance)
tFITrainingMetricsValue_modelPerformance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFITrainingMetricsValue' {Maybe TFIModelPerformance
modelPerformance :: Maybe TFIModelPerformance
$sel:modelPerformance:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe TFIModelPerformance
modelPerformance} -> Maybe TFIModelPerformance
modelPerformance) (\s :: TFITrainingMetricsValue
s@TFITrainingMetricsValue' {} Maybe TFIModelPerformance
a -> TFITrainingMetricsValue
s {$sel:modelPerformance:TFITrainingMetricsValue' :: Maybe TFIModelPerformance
modelPerformance = Maybe TFIModelPerformance
a} :: TFITrainingMetricsValue)

instance Data.FromJSON TFITrainingMetricsValue where
  parseJSON :: Value -> Parser TFITrainingMetricsValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TFITrainingMetricsValue"
      ( \Object
x ->
          Maybe [TFIMetricDataPoint]
-> Maybe TFIModelPerformance -> TFITrainingMetricsValue
TFITrainingMetricsValue'
            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
"metricDataPoints"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"modelPerformance")
      )

instance Prelude.Hashable TFITrainingMetricsValue where
  hashWithSalt :: Int -> TFITrainingMetricsValue -> Int
hashWithSalt Int
_salt TFITrainingMetricsValue' {Maybe [TFIMetricDataPoint]
Maybe TFIModelPerformance
modelPerformance :: Maybe TFIModelPerformance
metricDataPoints :: Maybe [TFIMetricDataPoint]
$sel:modelPerformance:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe TFIModelPerformance
$sel:metricDataPoints:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe [TFIMetricDataPoint]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TFIMetricDataPoint]
metricDataPoints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TFIModelPerformance
modelPerformance

instance Prelude.NFData TFITrainingMetricsValue where
  rnf :: TFITrainingMetricsValue -> ()
rnf TFITrainingMetricsValue' {Maybe [TFIMetricDataPoint]
Maybe TFIModelPerformance
modelPerformance :: Maybe TFIModelPerformance
metricDataPoints :: Maybe [TFIMetricDataPoint]
$sel:modelPerformance:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe TFIModelPerformance
$sel:metricDataPoints:TFITrainingMetricsValue' :: TFITrainingMetricsValue -> Maybe [TFIMetricDataPoint]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [TFIMetricDataPoint]
metricDataPoints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TFIModelPerformance
modelPerformance