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

import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.FieldValidationMessage
import Amazonka.FraudDetector.Types.FileValidationMessage
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The model training validation messages.
--
-- /See:/ 'newDataValidationMetrics' smart constructor.
data DataValidationMetrics = DataValidationMetrics'
  { -- | The field-specific model training validation messages.
    DataValidationMetrics -> Maybe [FieldValidationMessage]
fieldLevelMessages :: Prelude.Maybe [FieldValidationMessage],
    -- | The file-specific model training validation messages.
    DataValidationMetrics -> Maybe [FileValidationMessage]
fileLevelMessages :: Prelude.Maybe [FileValidationMessage]
  }
  deriving (DataValidationMetrics -> DataValidationMetrics -> Bool
(DataValidationMetrics -> DataValidationMetrics -> Bool)
-> (DataValidationMetrics -> DataValidationMetrics -> Bool)
-> Eq DataValidationMetrics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataValidationMetrics -> DataValidationMetrics -> Bool
$c/= :: DataValidationMetrics -> DataValidationMetrics -> Bool
== :: DataValidationMetrics -> DataValidationMetrics -> Bool
$c== :: DataValidationMetrics -> DataValidationMetrics -> Bool
Prelude.Eq, ReadPrec [DataValidationMetrics]
ReadPrec DataValidationMetrics
Int -> ReadS DataValidationMetrics
ReadS [DataValidationMetrics]
(Int -> ReadS DataValidationMetrics)
-> ReadS [DataValidationMetrics]
-> ReadPrec DataValidationMetrics
-> ReadPrec [DataValidationMetrics]
-> Read DataValidationMetrics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataValidationMetrics]
$creadListPrec :: ReadPrec [DataValidationMetrics]
readPrec :: ReadPrec DataValidationMetrics
$creadPrec :: ReadPrec DataValidationMetrics
readList :: ReadS [DataValidationMetrics]
$creadList :: ReadS [DataValidationMetrics]
readsPrec :: Int -> ReadS DataValidationMetrics
$creadsPrec :: Int -> ReadS DataValidationMetrics
Prelude.Read, Int -> DataValidationMetrics -> ShowS
[DataValidationMetrics] -> ShowS
DataValidationMetrics -> String
(Int -> DataValidationMetrics -> ShowS)
-> (DataValidationMetrics -> String)
-> ([DataValidationMetrics] -> ShowS)
-> Show DataValidationMetrics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataValidationMetrics] -> ShowS
$cshowList :: [DataValidationMetrics] -> ShowS
show :: DataValidationMetrics -> String
$cshow :: DataValidationMetrics -> String
showsPrec :: Int -> DataValidationMetrics -> ShowS
$cshowsPrec :: Int -> DataValidationMetrics -> ShowS
Prelude.Show, (forall x. DataValidationMetrics -> Rep DataValidationMetrics x)
-> (forall x. Rep DataValidationMetrics x -> DataValidationMetrics)
-> Generic DataValidationMetrics
forall x. Rep DataValidationMetrics x -> DataValidationMetrics
forall x. DataValidationMetrics -> Rep DataValidationMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataValidationMetrics x -> DataValidationMetrics
$cfrom :: forall x. DataValidationMetrics -> Rep DataValidationMetrics x
Prelude.Generic)

-- |
-- Create a value of 'DataValidationMetrics' 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:
--
-- 'fieldLevelMessages', 'dataValidationMetrics_fieldLevelMessages' - The field-specific model training validation messages.
--
-- 'fileLevelMessages', 'dataValidationMetrics_fileLevelMessages' - The file-specific model training validation messages.
newDataValidationMetrics ::
  DataValidationMetrics
newDataValidationMetrics :: DataValidationMetrics
newDataValidationMetrics =
  DataValidationMetrics' :: Maybe [FieldValidationMessage]
-> Maybe [FileValidationMessage] -> DataValidationMetrics
DataValidationMetrics'
    { $sel:fieldLevelMessages:DataValidationMetrics' :: Maybe [FieldValidationMessage]
fieldLevelMessages =
        Maybe [FieldValidationMessage]
forall a. Maybe a
Prelude.Nothing,
      $sel:fileLevelMessages:DataValidationMetrics' :: Maybe [FileValidationMessage]
fileLevelMessages = Maybe [FileValidationMessage]
forall a. Maybe a
Prelude.Nothing
    }

-- | The field-specific model training validation messages.
dataValidationMetrics_fieldLevelMessages :: Lens.Lens' DataValidationMetrics (Prelude.Maybe [FieldValidationMessage])
dataValidationMetrics_fieldLevelMessages :: (Maybe [FieldValidationMessage]
 -> f (Maybe [FieldValidationMessage]))
-> DataValidationMetrics -> f DataValidationMetrics
dataValidationMetrics_fieldLevelMessages = (DataValidationMetrics -> Maybe [FieldValidationMessage])
-> (DataValidationMetrics
    -> Maybe [FieldValidationMessage] -> DataValidationMetrics)
-> Lens
     DataValidationMetrics
     DataValidationMetrics
     (Maybe [FieldValidationMessage])
     (Maybe [FieldValidationMessage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValidationMetrics' {Maybe [FieldValidationMessage]
fieldLevelMessages :: Maybe [FieldValidationMessage]
$sel:fieldLevelMessages:DataValidationMetrics' :: DataValidationMetrics -> Maybe [FieldValidationMessage]
fieldLevelMessages} -> Maybe [FieldValidationMessage]
fieldLevelMessages) (\s :: DataValidationMetrics
s@DataValidationMetrics' {} Maybe [FieldValidationMessage]
a -> DataValidationMetrics
s {$sel:fieldLevelMessages:DataValidationMetrics' :: Maybe [FieldValidationMessage]
fieldLevelMessages = Maybe [FieldValidationMessage]
a} :: DataValidationMetrics) ((Maybe [FieldValidationMessage]
  -> f (Maybe [FieldValidationMessage]))
 -> DataValidationMetrics -> f DataValidationMetrics)
-> ((Maybe [FieldValidationMessage]
     -> f (Maybe [FieldValidationMessage]))
    -> Maybe [FieldValidationMessage]
    -> f (Maybe [FieldValidationMessage]))
-> (Maybe [FieldValidationMessage]
    -> f (Maybe [FieldValidationMessage]))
-> DataValidationMetrics
-> f DataValidationMetrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FieldValidationMessage]
  [FieldValidationMessage]
  [FieldValidationMessage]
  [FieldValidationMessage]
-> Iso
     (Maybe [FieldValidationMessage])
     (Maybe [FieldValidationMessage])
     (Maybe [FieldValidationMessage])
     (Maybe [FieldValidationMessage])
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
  [FieldValidationMessage]
  [FieldValidationMessage]
  [FieldValidationMessage]
  [FieldValidationMessage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The file-specific model training validation messages.
dataValidationMetrics_fileLevelMessages :: Lens.Lens' DataValidationMetrics (Prelude.Maybe [FileValidationMessage])
dataValidationMetrics_fileLevelMessages :: (Maybe [FileValidationMessage]
 -> f (Maybe [FileValidationMessage]))
-> DataValidationMetrics -> f DataValidationMetrics
dataValidationMetrics_fileLevelMessages = (DataValidationMetrics -> Maybe [FileValidationMessage])
-> (DataValidationMetrics
    -> Maybe [FileValidationMessage] -> DataValidationMetrics)
-> Lens
     DataValidationMetrics
     DataValidationMetrics
     (Maybe [FileValidationMessage])
     (Maybe [FileValidationMessage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValidationMetrics' {Maybe [FileValidationMessage]
fileLevelMessages :: Maybe [FileValidationMessage]
$sel:fileLevelMessages:DataValidationMetrics' :: DataValidationMetrics -> Maybe [FileValidationMessage]
fileLevelMessages} -> Maybe [FileValidationMessage]
fileLevelMessages) (\s :: DataValidationMetrics
s@DataValidationMetrics' {} Maybe [FileValidationMessage]
a -> DataValidationMetrics
s {$sel:fileLevelMessages:DataValidationMetrics' :: Maybe [FileValidationMessage]
fileLevelMessages = Maybe [FileValidationMessage]
a} :: DataValidationMetrics) ((Maybe [FileValidationMessage]
  -> f (Maybe [FileValidationMessage]))
 -> DataValidationMetrics -> f DataValidationMetrics)
-> ((Maybe [FileValidationMessage]
     -> f (Maybe [FileValidationMessage]))
    -> Maybe [FileValidationMessage]
    -> f (Maybe [FileValidationMessage]))
-> (Maybe [FileValidationMessage]
    -> f (Maybe [FileValidationMessage]))
-> DataValidationMetrics
-> f DataValidationMetrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FileValidationMessage]
  [FileValidationMessage]
  [FileValidationMessage]
  [FileValidationMessage]
-> Iso
     (Maybe [FileValidationMessage])
     (Maybe [FileValidationMessage])
     (Maybe [FileValidationMessage])
     (Maybe [FileValidationMessage])
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
  [FileValidationMessage]
  [FileValidationMessage]
  [FileValidationMessage]
  [FileValidationMessage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON DataValidationMetrics where
  parseJSON :: Value -> Parser DataValidationMetrics
parseJSON =
    String
-> (Object -> Parser DataValidationMetrics)
-> Value
-> Parser DataValidationMetrics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataValidationMetrics"
      ( \Object
x ->
          Maybe [FieldValidationMessage]
-> Maybe [FileValidationMessage] -> DataValidationMetrics
DataValidationMetrics'
            (Maybe [FieldValidationMessage]
 -> Maybe [FileValidationMessage] -> DataValidationMetrics)
-> Parser (Maybe [FieldValidationMessage])
-> Parser (Maybe [FileValidationMessage] -> DataValidationMetrics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [FieldValidationMessage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fieldLevelMessages"
                            Parser (Maybe (Maybe [FieldValidationMessage]))
-> Maybe [FieldValidationMessage]
-> Parser (Maybe [FieldValidationMessage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [FieldValidationMessage]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [FileValidationMessage] -> DataValidationMetrics)
-> Parser (Maybe [FileValidationMessage])
-> Parser DataValidationMetrics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [FileValidationMessage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fileLevelMessages"
                            Parser (Maybe (Maybe [FileValidationMessage]))
-> Maybe [FileValidationMessage]
-> Parser (Maybe [FileValidationMessage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [FileValidationMessage]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable DataValidationMetrics

instance Prelude.NFData DataValidationMetrics