{-# 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.OFITrainingMetricsValue
-- 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.OFITrainingMetricsValue 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.OFIMetricDataPoint
import Amazonka.FraudDetector.Types.OFIModelPerformance
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'OFITrainingMetricsValue' 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', 'oFITrainingMetricsValue_metricDataPoints' - The model\'s performance metrics data points.
--
-- 'modelPerformance', 'oFITrainingMetricsValue_modelPerformance' - The model\'s overall performance score.
newOFITrainingMetricsValue ::
  OFITrainingMetricsValue
newOFITrainingMetricsValue :: OFITrainingMetricsValue
newOFITrainingMetricsValue =
  OFITrainingMetricsValue'
    { $sel:metricDataPoints:OFITrainingMetricsValue' :: Maybe [OFIMetricDataPoint]
metricDataPoints =
        forall a. Maybe a
Prelude.Nothing,
      $sel:modelPerformance:OFITrainingMetricsValue' :: Maybe OFIModelPerformance
modelPerformance = forall a. Maybe a
Prelude.Nothing
    }

-- | The model\'s performance metrics data points.
oFITrainingMetricsValue_metricDataPoints :: Lens.Lens' OFITrainingMetricsValue (Prelude.Maybe [OFIMetricDataPoint])
oFITrainingMetricsValue_metricDataPoints :: Lens' OFITrainingMetricsValue (Maybe [OFIMetricDataPoint])
oFITrainingMetricsValue_metricDataPoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OFITrainingMetricsValue' {Maybe [OFIMetricDataPoint]
metricDataPoints :: Maybe [OFIMetricDataPoint]
$sel:metricDataPoints:OFITrainingMetricsValue' :: OFITrainingMetricsValue -> Maybe [OFIMetricDataPoint]
metricDataPoints} -> Maybe [OFIMetricDataPoint]
metricDataPoints) (\s :: OFITrainingMetricsValue
s@OFITrainingMetricsValue' {} Maybe [OFIMetricDataPoint]
a -> OFITrainingMetricsValue
s {$sel:metricDataPoints:OFITrainingMetricsValue' :: Maybe [OFIMetricDataPoint]
metricDataPoints = Maybe [OFIMetricDataPoint]
a} :: OFITrainingMetricsValue) 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\'s overall performance score.
oFITrainingMetricsValue_modelPerformance :: Lens.Lens' OFITrainingMetricsValue (Prelude.Maybe OFIModelPerformance)
oFITrainingMetricsValue_modelPerformance :: Lens' OFITrainingMetricsValue (Maybe OFIModelPerformance)
oFITrainingMetricsValue_modelPerformance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OFITrainingMetricsValue' {Maybe OFIModelPerformance
modelPerformance :: Maybe OFIModelPerformance
$sel:modelPerformance:OFITrainingMetricsValue' :: OFITrainingMetricsValue -> Maybe OFIModelPerformance
modelPerformance} -> Maybe OFIModelPerformance
modelPerformance) (\s :: OFITrainingMetricsValue
s@OFITrainingMetricsValue' {} Maybe OFIModelPerformance
a -> OFITrainingMetricsValue
s {$sel:modelPerformance:OFITrainingMetricsValue' :: Maybe OFIModelPerformance
modelPerformance = Maybe OFIModelPerformance
a} :: OFITrainingMetricsValue)

instance Data.FromJSON OFITrainingMetricsValue where
  parseJSON :: Value -> Parser OFITrainingMetricsValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OFITrainingMetricsValue"
      ( \Object
x ->
          Maybe [OFIMetricDataPoint]
-> Maybe OFIModelPerformance -> OFITrainingMetricsValue
OFITrainingMetricsValue'
            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 OFITrainingMetricsValue where
  hashWithSalt :: Int -> OFITrainingMetricsValue -> Int
hashWithSalt Int
_salt OFITrainingMetricsValue' {Maybe [OFIMetricDataPoint]
Maybe OFIModelPerformance
modelPerformance :: Maybe OFIModelPerformance
metricDataPoints :: Maybe [OFIMetricDataPoint]
$sel:modelPerformance:OFITrainingMetricsValue' :: OFITrainingMetricsValue -> Maybe OFIModelPerformance
$sel:metricDataPoints:OFITrainingMetricsValue' :: OFITrainingMetricsValue -> Maybe [OFIMetricDataPoint]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OFIMetricDataPoint]
metricDataPoints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OFIModelPerformance
modelPerformance

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