{-# 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.Personalize.Types.BatchInferenceJobConfig
-- 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.Personalize.Types.BatchInferenceJobConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The configuration details of a batch inference job.
--
-- /See:/ 'newBatchInferenceJobConfig' smart constructor.
data BatchInferenceJobConfig = BatchInferenceJobConfig'
  { -- | A string to string map specifying the exploration configuration
    -- hyperparameters, including @explorationWeight@ and
    -- @explorationItemAgeCutOff@, you want to use to configure the amount of
    -- item exploration Amazon Personalize uses when recommending items. See
    -- <https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html User-Personalization>.
    BatchInferenceJobConfig -> Maybe (HashMap Text Text)
itemExplorationConfig :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool
(BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool)
-> (BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool)
-> Eq BatchInferenceJobConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool
$c/= :: BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool
== :: BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool
$c== :: BatchInferenceJobConfig -> BatchInferenceJobConfig -> Bool
Prelude.Eq, ReadPrec [BatchInferenceJobConfig]
ReadPrec BatchInferenceJobConfig
Int -> ReadS BatchInferenceJobConfig
ReadS [BatchInferenceJobConfig]
(Int -> ReadS BatchInferenceJobConfig)
-> ReadS [BatchInferenceJobConfig]
-> ReadPrec BatchInferenceJobConfig
-> ReadPrec [BatchInferenceJobConfig]
-> Read BatchInferenceJobConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchInferenceJobConfig]
$creadListPrec :: ReadPrec [BatchInferenceJobConfig]
readPrec :: ReadPrec BatchInferenceJobConfig
$creadPrec :: ReadPrec BatchInferenceJobConfig
readList :: ReadS [BatchInferenceJobConfig]
$creadList :: ReadS [BatchInferenceJobConfig]
readsPrec :: Int -> ReadS BatchInferenceJobConfig
$creadsPrec :: Int -> ReadS BatchInferenceJobConfig
Prelude.Read, Int -> BatchInferenceJobConfig -> ShowS
[BatchInferenceJobConfig] -> ShowS
BatchInferenceJobConfig -> String
(Int -> BatchInferenceJobConfig -> ShowS)
-> (BatchInferenceJobConfig -> String)
-> ([BatchInferenceJobConfig] -> ShowS)
-> Show BatchInferenceJobConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchInferenceJobConfig] -> ShowS
$cshowList :: [BatchInferenceJobConfig] -> ShowS
show :: BatchInferenceJobConfig -> String
$cshow :: BatchInferenceJobConfig -> String
showsPrec :: Int -> BatchInferenceJobConfig -> ShowS
$cshowsPrec :: Int -> BatchInferenceJobConfig -> ShowS
Prelude.Show, (forall x.
 BatchInferenceJobConfig -> Rep BatchInferenceJobConfig x)
-> (forall x.
    Rep BatchInferenceJobConfig x -> BatchInferenceJobConfig)
-> Generic BatchInferenceJobConfig
forall x. Rep BatchInferenceJobConfig x -> BatchInferenceJobConfig
forall x. BatchInferenceJobConfig -> Rep BatchInferenceJobConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchInferenceJobConfig x -> BatchInferenceJobConfig
$cfrom :: forall x. BatchInferenceJobConfig -> Rep BatchInferenceJobConfig x
Prelude.Generic)

-- |
-- Create a value of 'BatchInferenceJobConfig' 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:
--
-- 'itemExplorationConfig', 'batchInferenceJobConfig_itemExplorationConfig' - A string to string map specifying the exploration configuration
-- hyperparameters, including @explorationWeight@ and
-- @explorationItemAgeCutOff@, you want to use to configure the amount of
-- item exploration Amazon Personalize uses when recommending items. See
-- <https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html User-Personalization>.
newBatchInferenceJobConfig ::
  BatchInferenceJobConfig
newBatchInferenceJobConfig :: BatchInferenceJobConfig
newBatchInferenceJobConfig =
  BatchInferenceJobConfig' :: Maybe (HashMap Text Text) -> BatchInferenceJobConfig
BatchInferenceJobConfig'
    { $sel:itemExplorationConfig:BatchInferenceJobConfig' :: Maybe (HashMap Text Text)
itemExplorationConfig =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A string to string map specifying the exploration configuration
-- hyperparameters, including @explorationWeight@ and
-- @explorationItemAgeCutOff@, you want to use to configure the amount of
-- item exploration Amazon Personalize uses when recommending items. See
-- <https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html User-Personalization>.
batchInferenceJobConfig_itemExplorationConfig :: Lens.Lens' BatchInferenceJobConfig (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
batchInferenceJobConfig_itemExplorationConfig :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> BatchInferenceJobConfig -> f BatchInferenceJobConfig
batchInferenceJobConfig_itemExplorationConfig = (BatchInferenceJobConfig -> Maybe (HashMap Text Text))
-> (BatchInferenceJobConfig
    -> Maybe (HashMap Text Text) -> BatchInferenceJobConfig)
-> Lens
     BatchInferenceJobConfig
     BatchInferenceJobConfig
     (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 (\BatchInferenceJobConfig' {Maybe (HashMap Text Text)
itemExplorationConfig :: Maybe (HashMap Text Text)
$sel:itemExplorationConfig:BatchInferenceJobConfig' :: BatchInferenceJobConfig -> Maybe (HashMap Text Text)
itemExplorationConfig} -> Maybe (HashMap Text Text)
itemExplorationConfig) (\s :: BatchInferenceJobConfig
s@BatchInferenceJobConfig' {} Maybe (HashMap Text Text)
a -> BatchInferenceJobConfig
s {$sel:itemExplorationConfig:BatchInferenceJobConfig' :: Maybe (HashMap Text Text)
itemExplorationConfig = Maybe (HashMap Text Text)
a} :: BatchInferenceJobConfig) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> BatchInferenceJobConfig -> f BatchInferenceJobConfig)
-> ((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)))
-> BatchInferenceJobConfig
-> f BatchInferenceJobConfig
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

instance Core.FromJSON BatchInferenceJobConfig where
  parseJSON :: Value -> Parser BatchInferenceJobConfig
parseJSON =
    String
-> (Object -> Parser BatchInferenceJobConfig)
-> Value
-> Parser BatchInferenceJobConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchInferenceJobConfig"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> BatchInferenceJobConfig
BatchInferenceJobConfig'
            (Maybe (HashMap Text Text) -> BatchInferenceJobConfig)
-> Parser (Maybe (HashMap Text Text))
-> Parser BatchInferenceJobConfig
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
"itemExplorationConfig"
                            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
                        )
      )

instance Prelude.Hashable BatchInferenceJobConfig

instance Prelude.NFData BatchInferenceJobConfig

instance Core.ToJSON BatchInferenceJobConfig where
  toJSON :: BatchInferenceJobConfig -> Value
toJSON BatchInferenceJobConfig' {Maybe (HashMap Text Text)
itemExplorationConfig :: Maybe (HashMap Text Text)
$sel:itemExplorationConfig:BatchInferenceJobConfig' :: BatchInferenceJobConfig -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"itemExplorationConfig" 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)
itemExplorationConfig
          ]
      )