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

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

-- | Provides information about a recipe. Each recipe provides an algorithm
-- that Amazon Personalize uses in model training when you use the
-- CreateSolution operation.
--
-- /See:/ 'newRecipe' smart constructor.
data Recipe = Recipe'
  { -- | The status of the recipe.
    Recipe -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the algorithm that Amazon Personalize
    -- uses to train the model.
    Recipe -> Maybe Text
algorithmArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the recipe.
    Recipe -> Maybe Text
recipeArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the FeatureTransformation object.
    Recipe -> Maybe Text
featureTransformationArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix format) that the recipe was last updated.
    Recipe -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the recipe.
    Recipe -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix format) that the recipe was created.
    Recipe -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | One of the following values:
    --
    -- -   PERSONALIZED_RANKING
    --
    -- -   RELATED_ITEMS
    --
    -- -   USER_PERSONALIZATION
    Recipe -> Maybe Text
recipeType :: Prelude.Maybe Prelude.Text,
    -- | The description of the recipe.
    Recipe -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Recipe -> Recipe -> Bool
(Recipe -> Recipe -> Bool)
-> (Recipe -> Recipe -> Bool) -> Eq Recipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Recipe -> Recipe -> Bool
$c/= :: Recipe -> Recipe -> Bool
== :: Recipe -> Recipe -> Bool
$c== :: Recipe -> Recipe -> Bool
Prelude.Eq, ReadPrec [Recipe]
ReadPrec Recipe
Int -> ReadS Recipe
ReadS [Recipe]
(Int -> ReadS Recipe)
-> ReadS [Recipe]
-> ReadPrec Recipe
-> ReadPrec [Recipe]
-> Read Recipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Recipe]
$creadListPrec :: ReadPrec [Recipe]
readPrec :: ReadPrec Recipe
$creadPrec :: ReadPrec Recipe
readList :: ReadS [Recipe]
$creadList :: ReadS [Recipe]
readsPrec :: Int -> ReadS Recipe
$creadsPrec :: Int -> ReadS Recipe
Prelude.Read, Int -> Recipe -> ShowS
[Recipe] -> ShowS
Recipe -> String
(Int -> Recipe -> ShowS)
-> (Recipe -> String) -> ([Recipe] -> ShowS) -> Show Recipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Recipe] -> ShowS
$cshowList :: [Recipe] -> ShowS
show :: Recipe -> String
$cshow :: Recipe -> String
showsPrec :: Int -> Recipe -> ShowS
$cshowsPrec :: Int -> Recipe -> ShowS
Prelude.Show, (forall x. Recipe -> Rep Recipe x)
-> (forall x. Rep Recipe x -> Recipe) -> Generic Recipe
forall x. Rep Recipe x -> Recipe
forall x. Recipe -> Rep Recipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Recipe x -> Recipe
$cfrom :: forall x. Recipe -> Rep Recipe x
Prelude.Generic)

-- |
-- Create a value of 'Recipe' 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:
--
-- 'status', 'recipe_status' - The status of the recipe.
--
-- 'algorithmArn', 'recipe_algorithmArn' - The Amazon Resource Name (ARN) of the algorithm that Amazon Personalize
-- uses to train the model.
--
-- 'recipeArn', 'recipe_recipeArn' - The Amazon Resource Name (ARN) of the recipe.
--
-- 'featureTransformationArn', 'recipe_featureTransformationArn' - The ARN of the FeatureTransformation object.
--
-- 'lastUpdatedDateTime', 'recipe_lastUpdatedDateTime' - The date and time (in Unix format) that the recipe was last updated.
--
-- 'name', 'recipe_name' - The name of the recipe.
--
-- 'creationDateTime', 'recipe_creationDateTime' - The date and time (in Unix format) that the recipe was created.
--
-- 'recipeType', 'recipe_recipeType' - One of the following values:
--
-- -   PERSONALIZED_RANKING
--
-- -   RELATED_ITEMS
--
-- -   USER_PERSONALIZATION
--
-- 'description', 'recipe_description' - The description of the recipe.
newRecipe ::
  Recipe
newRecipe :: Recipe
newRecipe =
  Recipe' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Recipe
Recipe'
    { $sel:status:Recipe' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:algorithmArn:Recipe' :: Maybe Text
algorithmArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recipeArn:Recipe' :: Maybe Text
recipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:featureTransformationArn:Recipe' :: Maybe Text
featureTransformationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:Recipe' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Recipe' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:Recipe' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:recipeType:Recipe' :: Maybe Text
recipeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Recipe' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the recipe.
recipe_status :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_status :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_status = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
status :: Maybe Text
$sel:status:Recipe' :: Recipe -> Maybe Text
status} -> Maybe Text
status) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:status:Recipe' :: Maybe Text
status = Maybe Text
a} :: Recipe)

-- | The Amazon Resource Name (ARN) of the algorithm that Amazon Personalize
-- uses to train the model.
recipe_algorithmArn :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_algorithmArn :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_algorithmArn = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
algorithmArn :: Maybe Text
$sel:algorithmArn:Recipe' :: Recipe -> Maybe Text
algorithmArn} -> Maybe Text
algorithmArn) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:algorithmArn:Recipe' :: Maybe Text
algorithmArn = Maybe Text
a} :: Recipe)

-- | The Amazon Resource Name (ARN) of the recipe.
recipe_recipeArn :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_recipeArn :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_recipeArn = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
recipeArn :: Maybe Text
$sel:recipeArn:Recipe' :: Recipe -> Maybe Text
recipeArn} -> Maybe Text
recipeArn) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:recipeArn:Recipe' :: Maybe Text
recipeArn = Maybe Text
a} :: Recipe)

-- | The ARN of the FeatureTransformation object.
recipe_featureTransformationArn :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_featureTransformationArn :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_featureTransformationArn = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
featureTransformationArn :: Maybe Text
$sel:featureTransformationArn:Recipe' :: Recipe -> Maybe Text
featureTransformationArn} -> Maybe Text
featureTransformationArn) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:featureTransformationArn:Recipe' :: Maybe Text
featureTransformationArn = Maybe Text
a} :: Recipe)

-- | The date and time (in Unix format) that the recipe was last updated.
recipe_lastUpdatedDateTime :: Lens.Lens' Recipe (Prelude.Maybe Prelude.UTCTime)
recipe_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Recipe -> f Recipe
recipe_lastUpdatedDateTime = (Recipe -> Maybe POSIX)
-> (Recipe -> Maybe POSIX -> Recipe)
-> Lens Recipe Recipe (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:Recipe' :: Recipe -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: Recipe
s@Recipe' {} Maybe POSIX
a -> Recipe
s {$sel:lastUpdatedDateTime:Recipe' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: Recipe) ((Maybe POSIX -> f (Maybe POSIX)) -> Recipe -> f Recipe)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Recipe
-> f Recipe
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the recipe.
recipe_name :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_name :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_name = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
name :: Maybe Text
$sel:name:Recipe' :: Recipe -> Maybe Text
name} -> Maybe Text
name) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:name:Recipe' :: Maybe Text
name = Maybe Text
a} :: Recipe)

-- | The date and time (in Unix format) that the recipe was created.
recipe_creationDateTime :: Lens.Lens' Recipe (Prelude.Maybe Prelude.UTCTime)
recipe_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Recipe -> f Recipe
recipe_creationDateTime = (Recipe -> Maybe POSIX)
-> (Recipe -> Maybe POSIX -> Recipe)
-> Lens Recipe Recipe (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:Recipe' :: Recipe -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: Recipe
s@Recipe' {} Maybe POSIX
a -> Recipe
s {$sel:creationDateTime:Recipe' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: Recipe) ((Maybe POSIX -> f (Maybe POSIX)) -> Recipe -> f Recipe)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Recipe
-> f Recipe
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | One of the following values:
--
-- -   PERSONALIZED_RANKING
--
-- -   RELATED_ITEMS
--
-- -   USER_PERSONALIZATION
recipe_recipeType :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_recipeType :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_recipeType = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
recipeType :: Maybe Text
$sel:recipeType:Recipe' :: Recipe -> Maybe Text
recipeType} -> Maybe Text
recipeType) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:recipeType:Recipe' :: Maybe Text
recipeType = Maybe Text
a} :: Recipe)

-- | The description of the recipe.
recipe_description :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_description :: (Maybe Text -> f (Maybe Text)) -> Recipe -> f Recipe
recipe_description = (Recipe -> Maybe Text)
-> (Recipe -> Maybe Text -> Recipe)
-> Lens Recipe Recipe (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recipe' {Maybe Text
description :: Maybe Text
$sel:description:Recipe' :: Recipe -> Maybe Text
description} -> Maybe Text
description) (\s :: Recipe
s@Recipe' {} Maybe Text
a -> Recipe
s {$sel:description:Recipe' :: Maybe Text
description = Maybe Text
a} :: Recipe)

instance Core.FromJSON Recipe where
  parseJSON :: Value -> Parser Recipe
parseJSON =
    String -> (Object -> Parser Recipe) -> Value -> Parser Recipe
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Recipe"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Recipe
Recipe'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Recipe)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Recipe)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Recipe)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithmArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Recipe)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recipeArn")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Recipe)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"featureTransformationArn")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedDateTime")
            Parser
  (Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Recipe)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDateTime")
            Parser (Maybe Text -> Maybe Text -> Recipe)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Recipe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recipeType")
            Parser (Maybe Text -> Recipe)
-> Parser (Maybe Text) -> Parser Recipe
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
      )

instance Prelude.Hashable Recipe

instance Prelude.NFData Recipe