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

import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.ModelOutputDataFormat
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the Amazon Sagemaker model output configuration.
--
-- /See:/ 'newModelOutputConfiguration' smart constructor.
data ModelOutputConfiguration = ModelOutputConfiguration'
  { -- | A map of JSON keys in response from SageMaker to the Amazon Fraud
    -- Detector variables.
    ModelOutputConfiguration -> Maybe (HashMap Text Text)
jsonKeyToVariableMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A map of CSV index values in the SageMaker response to the Amazon Fraud
    -- Detector variables.
    ModelOutputConfiguration -> Maybe (HashMap Text Text)
csvIndexToVariableMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The format of the model output configuration.
    ModelOutputConfiguration -> ModelOutputDataFormat
format :: ModelOutputDataFormat
  }
  deriving (ModelOutputConfiguration -> ModelOutputConfiguration -> Bool
(ModelOutputConfiguration -> ModelOutputConfiguration -> Bool)
-> (ModelOutputConfiguration -> ModelOutputConfiguration -> Bool)
-> Eq ModelOutputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelOutputConfiguration -> ModelOutputConfiguration -> Bool
$c/= :: ModelOutputConfiguration -> ModelOutputConfiguration -> Bool
== :: ModelOutputConfiguration -> ModelOutputConfiguration -> Bool
$c== :: ModelOutputConfiguration -> ModelOutputConfiguration -> Bool
Prelude.Eq, ReadPrec [ModelOutputConfiguration]
ReadPrec ModelOutputConfiguration
Int -> ReadS ModelOutputConfiguration
ReadS [ModelOutputConfiguration]
(Int -> ReadS ModelOutputConfiguration)
-> ReadS [ModelOutputConfiguration]
-> ReadPrec ModelOutputConfiguration
-> ReadPrec [ModelOutputConfiguration]
-> Read ModelOutputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelOutputConfiguration]
$creadListPrec :: ReadPrec [ModelOutputConfiguration]
readPrec :: ReadPrec ModelOutputConfiguration
$creadPrec :: ReadPrec ModelOutputConfiguration
readList :: ReadS [ModelOutputConfiguration]
$creadList :: ReadS [ModelOutputConfiguration]
readsPrec :: Int -> ReadS ModelOutputConfiguration
$creadsPrec :: Int -> ReadS ModelOutputConfiguration
Prelude.Read, Int -> ModelOutputConfiguration -> ShowS
[ModelOutputConfiguration] -> ShowS
ModelOutputConfiguration -> String
(Int -> ModelOutputConfiguration -> ShowS)
-> (ModelOutputConfiguration -> String)
-> ([ModelOutputConfiguration] -> ShowS)
-> Show ModelOutputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelOutputConfiguration] -> ShowS
$cshowList :: [ModelOutputConfiguration] -> ShowS
show :: ModelOutputConfiguration -> String
$cshow :: ModelOutputConfiguration -> String
showsPrec :: Int -> ModelOutputConfiguration -> ShowS
$cshowsPrec :: Int -> ModelOutputConfiguration -> ShowS
Prelude.Show, (forall x.
 ModelOutputConfiguration -> Rep ModelOutputConfiguration x)
-> (forall x.
    Rep ModelOutputConfiguration x -> ModelOutputConfiguration)
-> Generic ModelOutputConfiguration
forall x.
Rep ModelOutputConfiguration x -> ModelOutputConfiguration
forall x.
ModelOutputConfiguration -> Rep ModelOutputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModelOutputConfiguration x -> ModelOutputConfiguration
$cfrom :: forall x.
ModelOutputConfiguration -> Rep ModelOutputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ModelOutputConfiguration' 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:
--
-- 'jsonKeyToVariableMap', 'modelOutputConfiguration_jsonKeyToVariableMap' - A map of JSON keys in response from SageMaker to the Amazon Fraud
-- Detector variables.
--
-- 'csvIndexToVariableMap', 'modelOutputConfiguration_csvIndexToVariableMap' - A map of CSV index values in the SageMaker response to the Amazon Fraud
-- Detector variables.
--
-- 'format', 'modelOutputConfiguration_format' - The format of the model output configuration.
newModelOutputConfiguration ::
  -- | 'format'
  ModelOutputDataFormat ->
  ModelOutputConfiguration
newModelOutputConfiguration :: ModelOutputDataFormat -> ModelOutputConfiguration
newModelOutputConfiguration ModelOutputDataFormat
pFormat_ =
  ModelOutputConfiguration' :: Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text)
-> ModelOutputDataFormat
-> ModelOutputConfiguration
ModelOutputConfiguration'
    { $sel:jsonKeyToVariableMap:ModelOutputConfiguration' :: Maybe (HashMap Text Text)
jsonKeyToVariableMap =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:csvIndexToVariableMap:ModelOutputConfiguration' :: Maybe (HashMap Text Text)
csvIndexToVariableMap = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:format:ModelOutputConfiguration' :: ModelOutputDataFormat
format = ModelOutputDataFormat
pFormat_
    }

-- | A map of JSON keys in response from SageMaker to the Amazon Fraud
-- Detector variables.
modelOutputConfiguration_jsonKeyToVariableMap :: Lens.Lens' ModelOutputConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
modelOutputConfiguration_jsonKeyToVariableMap :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelOutputConfiguration -> f ModelOutputConfiguration
modelOutputConfiguration_jsonKeyToVariableMap = (ModelOutputConfiguration -> Maybe (HashMap Text Text))
-> (ModelOutputConfiguration
    -> Maybe (HashMap Text Text) -> ModelOutputConfiguration)
-> Lens
     ModelOutputConfiguration
     ModelOutputConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelOutputConfiguration' {Maybe (HashMap Text Text)
jsonKeyToVariableMap :: Maybe (HashMap Text Text)
$sel:jsonKeyToVariableMap:ModelOutputConfiguration' :: ModelOutputConfiguration -> Maybe (HashMap Text Text)
jsonKeyToVariableMap} -> Maybe (HashMap Text Text)
jsonKeyToVariableMap) (\s :: ModelOutputConfiguration
s@ModelOutputConfiguration' {} Maybe (HashMap Text Text)
a -> ModelOutputConfiguration
s {$sel:jsonKeyToVariableMap:ModelOutputConfiguration' :: Maybe (HashMap Text Text)
jsonKeyToVariableMap = Maybe (HashMap Text Text)
a} :: ModelOutputConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ModelOutputConfiguration -> f ModelOutputConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelOutputConfiguration
-> f ModelOutputConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A map of CSV index values in the SageMaker response to the Amazon Fraud
-- Detector variables.
modelOutputConfiguration_csvIndexToVariableMap :: Lens.Lens' ModelOutputConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
modelOutputConfiguration_csvIndexToVariableMap :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelOutputConfiguration -> f ModelOutputConfiguration
modelOutputConfiguration_csvIndexToVariableMap = (ModelOutputConfiguration -> Maybe (HashMap Text Text))
-> (ModelOutputConfiguration
    -> Maybe (HashMap Text Text) -> ModelOutputConfiguration)
-> Lens
     ModelOutputConfiguration
     ModelOutputConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelOutputConfiguration' {Maybe (HashMap Text Text)
csvIndexToVariableMap :: Maybe (HashMap Text Text)
$sel:csvIndexToVariableMap:ModelOutputConfiguration' :: ModelOutputConfiguration -> Maybe (HashMap Text Text)
csvIndexToVariableMap} -> Maybe (HashMap Text Text)
csvIndexToVariableMap) (\s :: ModelOutputConfiguration
s@ModelOutputConfiguration' {} Maybe (HashMap Text Text)
a -> ModelOutputConfiguration
s {$sel:csvIndexToVariableMap:ModelOutputConfiguration' :: Maybe (HashMap Text Text)
csvIndexToVariableMap = Maybe (HashMap Text Text)
a} :: ModelOutputConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ModelOutputConfiguration -> f ModelOutputConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelOutputConfiguration
-> f ModelOutputConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The format of the model output configuration.
modelOutputConfiguration_format :: Lens.Lens' ModelOutputConfiguration ModelOutputDataFormat
modelOutputConfiguration_format :: (ModelOutputDataFormat -> f ModelOutputDataFormat)
-> ModelOutputConfiguration -> f ModelOutputConfiguration
modelOutputConfiguration_format = (ModelOutputConfiguration -> ModelOutputDataFormat)
-> (ModelOutputConfiguration
    -> ModelOutputDataFormat -> ModelOutputConfiguration)
-> Lens
     ModelOutputConfiguration
     ModelOutputConfiguration
     ModelOutputDataFormat
     ModelOutputDataFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelOutputConfiguration' {ModelOutputDataFormat
format :: ModelOutputDataFormat
$sel:format:ModelOutputConfiguration' :: ModelOutputConfiguration -> ModelOutputDataFormat
format} -> ModelOutputDataFormat
format) (\s :: ModelOutputConfiguration
s@ModelOutputConfiguration' {} ModelOutputDataFormat
a -> ModelOutputConfiguration
s {$sel:format:ModelOutputConfiguration' :: ModelOutputDataFormat
format = ModelOutputDataFormat
a} :: ModelOutputConfiguration)

instance Core.FromJSON ModelOutputConfiguration where
  parseJSON :: Value -> Parser ModelOutputConfiguration
parseJSON =
    String
-> (Object -> Parser ModelOutputConfiguration)
-> Value
-> Parser ModelOutputConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelOutputConfiguration"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text)
-> ModelOutputDataFormat
-> ModelOutputConfiguration
ModelOutputConfiguration'
            (Maybe (HashMap Text Text)
 -> Maybe (HashMap Text Text)
 -> ModelOutputDataFormat
 -> ModelOutputConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe (HashMap Text Text)
      -> ModelOutputDataFormat -> ModelOutputConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"jsonKeyToVariableMap"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe (HashMap Text Text)
   -> ModelOutputDataFormat -> ModelOutputConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser (ModelOutputDataFormat -> ModelOutputConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"csvIndexToVariableMap"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (ModelOutputDataFormat -> ModelOutputConfiguration)
-> Parser ModelOutputDataFormat -> Parser ModelOutputConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ModelOutputDataFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"format")
      )

instance Prelude.Hashable ModelOutputConfiguration

instance Prelude.NFData ModelOutputConfiguration

instance Core.ToJSON ModelOutputConfiguration where
  toJSON :: ModelOutputConfiguration -> Value
toJSON ModelOutputConfiguration' {Maybe (HashMap Text Text)
ModelOutputDataFormat
format :: ModelOutputDataFormat
csvIndexToVariableMap :: Maybe (HashMap Text Text)
jsonKeyToVariableMap :: Maybe (HashMap Text Text)
$sel:format:ModelOutputConfiguration' :: ModelOutputConfiguration -> ModelOutputDataFormat
$sel:csvIndexToVariableMap:ModelOutputConfiguration' :: ModelOutputConfiguration -> Maybe (HashMap Text Text)
$sel:jsonKeyToVariableMap:ModelOutputConfiguration' :: ModelOutputConfiguration -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"jsonKeyToVariableMap" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
jsonKeyToVariableMap,
            (Text
"csvIndexToVariableMap" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
csvIndexToVariableMap,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"format" Text -> ModelOutputDataFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ModelOutputDataFormat
format)
          ]
      )