{-# 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.ModelInputConfiguration
-- 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.ModelInputConfiguration 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.ModelInputDataFormat
import qualified Amazonka.Prelude as Prelude

-- | The Amazon SageMaker model input configuration.
--
-- /See:/ 'newModelInputConfiguration' smart constructor.
data ModelInputConfiguration = ModelInputConfiguration'
  { -- | Template for constructing the CSV input-data sent to SageMaker. At
    -- event-evaluation, the placeholders for variable-names in the template
    -- will be replaced with the variable values before being sent to
    -- SageMaker.
    ModelInputConfiguration -> Maybe Text
csvInputTemplate :: Prelude.Maybe Prelude.Text,
    -- | The event type name.
    ModelInputConfiguration -> Maybe Text
eventTypeName :: Prelude.Maybe Prelude.Text,
    -- | The format of the model input configuration. The format differs
    -- depending on if it is passed through to SageMaker or constructed by
    -- Amazon Fraud Detector.
    ModelInputConfiguration -> Maybe ModelInputDataFormat
format :: Prelude.Maybe ModelInputDataFormat,
    -- | Template for constructing the JSON input-data sent to SageMaker. At
    -- event-evaluation, the placeholders for variable names in the template
    -- will be replaced with the variable values before being sent to
    -- SageMaker.
    ModelInputConfiguration -> Maybe Text
jsonInputTemplate :: Prelude.Maybe Prelude.Text,
    -- | The event variables.
    ModelInputConfiguration -> Bool
useEventVariables :: Prelude.Bool
  }
  deriving (ModelInputConfiguration -> ModelInputConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelInputConfiguration -> ModelInputConfiguration -> Bool
$c/= :: ModelInputConfiguration -> ModelInputConfiguration -> Bool
== :: ModelInputConfiguration -> ModelInputConfiguration -> Bool
$c== :: ModelInputConfiguration -> ModelInputConfiguration -> Bool
Prelude.Eq, ReadPrec [ModelInputConfiguration]
ReadPrec ModelInputConfiguration
Int -> ReadS ModelInputConfiguration
ReadS [ModelInputConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelInputConfiguration]
$creadListPrec :: ReadPrec [ModelInputConfiguration]
readPrec :: ReadPrec ModelInputConfiguration
$creadPrec :: ReadPrec ModelInputConfiguration
readList :: ReadS [ModelInputConfiguration]
$creadList :: ReadS [ModelInputConfiguration]
readsPrec :: Int -> ReadS ModelInputConfiguration
$creadsPrec :: Int -> ReadS ModelInputConfiguration
Prelude.Read, Int -> ModelInputConfiguration -> ShowS
[ModelInputConfiguration] -> ShowS
ModelInputConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelInputConfiguration] -> ShowS
$cshowList :: [ModelInputConfiguration] -> ShowS
show :: ModelInputConfiguration -> String
$cshow :: ModelInputConfiguration -> String
showsPrec :: Int -> ModelInputConfiguration -> ShowS
$cshowsPrec :: Int -> ModelInputConfiguration -> ShowS
Prelude.Show, forall x. Rep ModelInputConfiguration x -> ModelInputConfiguration
forall x. ModelInputConfiguration -> Rep ModelInputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelInputConfiguration x -> ModelInputConfiguration
$cfrom :: forall x. ModelInputConfiguration -> Rep ModelInputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ModelInputConfiguration' 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:
--
-- 'csvInputTemplate', 'modelInputConfiguration_csvInputTemplate' - Template for constructing the CSV input-data sent to SageMaker. At
-- event-evaluation, the placeholders for variable-names in the template
-- will be replaced with the variable values before being sent to
-- SageMaker.
--
-- 'eventTypeName', 'modelInputConfiguration_eventTypeName' - The event type name.
--
-- 'format', 'modelInputConfiguration_format' - The format of the model input configuration. The format differs
-- depending on if it is passed through to SageMaker or constructed by
-- Amazon Fraud Detector.
--
-- 'jsonInputTemplate', 'modelInputConfiguration_jsonInputTemplate' - Template for constructing the JSON input-data sent to SageMaker. At
-- event-evaluation, the placeholders for variable names in the template
-- will be replaced with the variable values before being sent to
-- SageMaker.
--
-- 'useEventVariables', 'modelInputConfiguration_useEventVariables' - The event variables.
newModelInputConfiguration ::
  -- | 'useEventVariables'
  Prelude.Bool ->
  ModelInputConfiguration
newModelInputConfiguration :: Bool -> ModelInputConfiguration
newModelInputConfiguration Bool
pUseEventVariables_ =
  ModelInputConfiguration'
    { $sel:csvInputTemplate:ModelInputConfiguration' :: Maybe Text
csvInputTemplate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:eventTypeName:ModelInputConfiguration' :: Maybe Text
eventTypeName = forall a. Maybe a
Prelude.Nothing,
      $sel:format:ModelInputConfiguration' :: Maybe ModelInputDataFormat
format = forall a. Maybe a
Prelude.Nothing,
      $sel:jsonInputTemplate:ModelInputConfiguration' :: Maybe Text
jsonInputTemplate = forall a. Maybe a
Prelude.Nothing,
      $sel:useEventVariables:ModelInputConfiguration' :: Bool
useEventVariables = Bool
pUseEventVariables_
    }

-- | Template for constructing the CSV input-data sent to SageMaker. At
-- event-evaluation, the placeholders for variable-names in the template
-- will be replaced with the variable values before being sent to
-- SageMaker.
modelInputConfiguration_csvInputTemplate :: Lens.Lens' ModelInputConfiguration (Prelude.Maybe Prelude.Text)
modelInputConfiguration_csvInputTemplate :: Lens' ModelInputConfiguration (Maybe Text)
modelInputConfiguration_csvInputTemplate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInputConfiguration' {Maybe Text
csvInputTemplate :: Maybe Text
$sel:csvInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
csvInputTemplate} -> Maybe Text
csvInputTemplate) (\s :: ModelInputConfiguration
s@ModelInputConfiguration' {} Maybe Text
a -> ModelInputConfiguration
s {$sel:csvInputTemplate:ModelInputConfiguration' :: Maybe Text
csvInputTemplate = Maybe Text
a} :: ModelInputConfiguration)

-- | The event type name.
modelInputConfiguration_eventTypeName :: Lens.Lens' ModelInputConfiguration (Prelude.Maybe Prelude.Text)
modelInputConfiguration_eventTypeName :: Lens' ModelInputConfiguration (Maybe Text)
modelInputConfiguration_eventTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInputConfiguration' {Maybe Text
eventTypeName :: Maybe Text
$sel:eventTypeName:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
eventTypeName} -> Maybe Text
eventTypeName) (\s :: ModelInputConfiguration
s@ModelInputConfiguration' {} Maybe Text
a -> ModelInputConfiguration
s {$sel:eventTypeName:ModelInputConfiguration' :: Maybe Text
eventTypeName = Maybe Text
a} :: ModelInputConfiguration)

-- | The format of the model input configuration. The format differs
-- depending on if it is passed through to SageMaker or constructed by
-- Amazon Fraud Detector.
modelInputConfiguration_format :: Lens.Lens' ModelInputConfiguration (Prelude.Maybe ModelInputDataFormat)
modelInputConfiguration_format :: Lens' ModelInputConfiguration (Maybe ModelInputDataFormat)
modelInputConfiguration_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInputConfiguration' {Maybe ModelInputDataFormat
format :: Maybe ModelInputDataFormat
$sel:format:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe ModelInputDataFormat
format} -> Maybe ModelInputDataFormat
format) (\s :: ModelInputConfiguration
s@ModelInputConfiguration' {} Maybe ModelInputDataFormat
a -> ModelInputConfiguration
s {$sel:format:ModelInputConfiguration' :: Maybe ModelInputDataFormat
format = Maybe ModelInputDataFormat
a} :: ModelInputConfiguration)

-- | Template for constructing the JSON input-data sent to SageMaker. At
-- event-evaluation, the placeholders for variable names in the template
-- will be replaced with the variable values before being sent to
-- SageMaker.
modelInputConfiguration_jsonInputTemplate :: Lens.Lens' ModelInputConfiguration (Prelude.Maybe Prelude.Text)
modelInputConfiguration_jsonInputTemplate :: Lens' ModelInputConfiguration (Maybe Text)
modelInputConfiguration_jsonInputTemplate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInputConfiguration' {Maybe Text
jsonInputTemplate :: Maybe Text
$sel:jsonInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
jsonInputTemplate} -> Maybe Text
jsonInputTemplate) (\s :: ModelInputConfiguration
s@ModelInputConfiguration' {} Maybe Text
a -> ModelInputConfiguration
s {$sel:jsonInputTemplate:ModelInputConfiguration' :: Maybe Text
jsonInputTemplate = Maybe Text
a} :: ModelInputConfiguration)

-- | The event variables.
modelInputConfiguration_useEventVariables :: Lens.Lens' ModelInputConfiguration Prelude.Bool
modelInputConfiguration_useEventVariables :: Lens' ModelInputConfiguration Bool
modelInputConfiguration_useEventVariables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInputConfiguration' {Bool
useEventVariables :: Bool
$sel:useEventVariables:ModelInputConfiguration' :: ModelInputConfiguration -> Bool
useEventVariables} -> Bool
useEventVariables) (\s :: ModelInputConfiguration
s@ModelInputConfiguration' {} Bool
a -> ModelInputConfiguration
s {$sel:useEventVariables:ModelInputConfiguration' :: Bool
useEventVariables = Bool
a} :: ModelInputConfiguration)

instance Data.FromJSON ModelInputConfiguration where
  parseJSON :: Value -> Parser ModelInputConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelInputConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ModelInputDataFormat
-> Maybe Text
-> Bool
-> ModelInputConfiguration
ModelInputConfiguration'
            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
"csvInputTemplate")
            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
"eventTypeName")
            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
"format")
            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
"jsonInputTemplate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"useEventVariables")
      )

instance Prelude.Hashable ModelInputConfiguration where
  hashWithSalt :: Int -> ModelInputConfiguration -> Int
hashWithSalt Int
_salt ModelInputConfiguration' {Bool
Maybe Text
Maybe ModelInputDataFormat
useEventVariables :: Bool
jsonInputTemplate :: Maybe Text
format :: Maybe ModelInputDataFormat
eventTypeName :: Maybe Text
csvInputTemplate :: Maybe Text
$sel:useEventVariables:ModelInputConfiguration' :: ModelInputConfiguration -> Bool
$sel:jsonInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:format:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe ModelInputDataFormat
$sel:eventTypeName:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:csvInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
csvInputTemplate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ModelInputDataFormat
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jsonInputTemplate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
useEventVariables

instance Prelude.NFData ModelInputConfiguration where
  rnf :: ModelInputConfiguration -> ()
rnf ModelInputConfiguration' {Bool
Maybe Text
Maybe ModelInputDataFormat
useEventVariables :: Bool
jsonInputTemplate :: Maybe Text
format :: Maybe ModelInputDataFormat
eventTypeName :: Maybe Text
csvInputTemplate :: Maybe Text
$sel:useEventVariables:ModelInputConfiguration' :: ModelInputConfiguration -> Bool
$sel:jsonInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:format:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe ModelInputDataFormat
$sel:eventTypeName:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:csvInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
csvInputTemplate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ModelInputDataFormat
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jsonInputTemplate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
useEventVariables

instance Data.ToJSON ModelInputConfiguration where
  toJSON :: ModelInputConfiguration -> Value
toJSON ModelInputConfiguration' {Bool
Maybe Text
Maybe ModelInputDataFormat
useEventVariables :: Bool
jsonInputTemplate :: Maybe Text
format :: Maybe ModelInputDataFormat
eventTypeName :: Maybe Text
csvInputTemplate :: Maybe Text
$sel:useEventVariables:ModelInputConfiguration' :: ModelInputConfiguration -> Bool
$sel:jsonInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:format:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe ModelInputDataFormat
$sel:eventTypeName:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
$sel:csvInputTemplate:ModelInputConfiguration' :: ModelInputConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"csvInputTemplate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
csvInputTemplate,
            (Key
"eventTypeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eventTypeName,
            (Key
"format" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ModelInputDataFormat
format,
            (Key
"jsonInputTemplate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jsonInputTemplate,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"useEventVariables" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
useEventVariables)
          ]
      )