{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Personalize.Types.Recipe where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolution.html CreateSolution>
-- operation.
--
-- /See:/ 'newRecipe' smart constructor.
data Recipe = Recipe'
  { -- | 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 date and time (in Unix format) that the recipe was created.
    Recipe -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | The description of the recipe.
    Recipe -> Maybe Text
description :: 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 Data.POSIX,
    -- | The name of the recipe.
    Recipe -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the recipe.
    Recipe -> Maybe Text
recipeArn :: Prelude.Maybe Prelude.Text,
    -- | One of the following values:
    --
    -- -   PERSONALIZED_RANKING
    --
    -- -   RELATED_ITEMS
    --
    -- -   USER_PERSONALIZATION
    Recipe -> Maybe Text
recipeType :: Prelude.Maybe Prelude.Text,
    -- | The status of the recipe.
    Recipe -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (Recipe -> Recipe -> Bool
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]
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
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. 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:
--
-- 'algorithmArn', 'recipe_algorithmArn' - The Amazon Resource Name (ARN) of the algorithm that Amazon Personalize
-- uses to train the model.
--
-- 'creationDateTime', 'recipe_creationDateTime' - The date and time (in Unix format) that the recipe was created.
--
-- 'description', 'recipe_description' - The description 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.
--
-- 'recipeArn', 'recipe_recipeArn' - The Amazon Resource Name (ARN) of the recipe.
--
-- 'recipeType', 'recipe_recipeType' - One of the following values:
--
-- -   PERSONALIZED_RANKING
--
-- -   RELATED_ITEMS
--
-- -   USER_PERSONALIZATION
--
-- 'status', 'recipe_status' - The status of the recipe.
newRecipe ::
  Recipe
newRecipe :: Recipe
newRecipe =
  Recipe'
    { $sel:algorithmArn:Recipe' :: Maybe Text
algorithmArn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:Recipe' :: Maybe POSIX
creationDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Recipe' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:featureTransformationArn:Recipe' :: Maybe Text
featureTransformationArn = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:Recipe' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Recipe' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:recipeArn:Recipe' :: Maybe Text
recipeArn = forall a. Maybe a
Prelude.Nothing,
      $sel:recipeType:Recipe' :: Maybe Text
recipeType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Recipe' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' Recipe (Maybe Text)
recipe_algorithmArn = 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 date and time (in Unix format) that the recipe was created.
recipe_creationDateTime :: Lens.Lens' Recipe (Prelude.Maybe Prelude.UTCTime)
recipe_creationDateTime :: Lens' Recipe (Maybe UTCTime)
recipe_creationDateTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the recipe.
recipe_description :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_description :: Lens' Recipe (Maybe Text)
recipe_description = 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)

-- | The ARN of the FeatureTransformation object.
recipe_featureTransformationArn :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_featureTransformationArn :: Lens' Recipe (Maybe Text)
recipe_featureTransformationArn = 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 :: Lens' Recipe (Maybe UTCTime)
recipe_lastUpdatedDateTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the recipe.
recipe_name :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_name :: Lens' Recipe (Maybe Text)
recipe_name = 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 Amazon Resource Name (ARN) of the recipe.
recipe_recipeArn :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_recipeArn :: Lens' Recipe (Maybe Text)
recipe_recipeArn = 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)

-- | One of the following values:
--
-- -   PERSONALIZED_RANKING
--
-- -   RELATED_ITEMS
--
-- -   USER_PERSONALIZATION
recipe_recipeType :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_recipeType :: Lens' Recipe (Maybe Text)
recipe_recipeType = 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 status of the recipe.
recipe_status :: Lens.Lens' Recipe (Prelude.Maybe Prelude.Text)
recipe_status :: Lens' Recipe (Maybe Text)
recipe_status = 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)

instance Data.FromJSON Recipe where
  parseJSON :: Value -> Parser Recipe
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Recipe"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Recipe
Recipe'
            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
"algorithmArn")
            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
"creationDateTime")
            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
"description")
            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
"featureTransformationArn")
            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
"lastUpdatedDateTime")
            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
"name")
            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
"recipeArn")
            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
"recipeType")
            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
"status")
      )

instance Prelude.Hashable Recipe where
  hashWithSalt :: Int -> Recipe -> Int
hashWithSalt Int
_salt Recipe' {Maybe Text
Maybe POSIX
status :: Maybe Text
recipeType :: Maybe Text
recipeArn :: Maybe Text
name :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
featureTransformationArn :: Maybe Text
description :: Maybe Text
creationDateTime :: Maybe POSIX
algorithmArn :: Maybe Text
$sel:status:Recipe' :: Recipe -> Maybe Text
$sel:recipeType:Recipe' :: Recipe -> Maybe Text
$sel:recipeArn:Recipe' :: Recipe -> Maybe Text
$sel:name:Recipe' :: Recipe -> Maybe Text
$sel:lastUpdatedDateTime:Recipe' :: Recipe -> Maybe POSIX
$sel:featureTransformationArn:Recipe' :: Recipe -> Maybe Text
$sel:description:Recipe' :: Recipe -> Maybe Text
$sel:creationDateTime:Recipe' :: Recipe -> Maybe POSIX
$sel:algorithmArn:Recipe' :: Recipe -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
algorithmArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
featureTransformationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recipeArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recipeType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData Recipe where
  rnf :: Recipe -> ()
rnf Recipe' {Maybe Text
Maybe POSIX
status :: Maybe Text
recipeType :: Maybe Text
recipeArn :: Maybe Text
name :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
featureTransformationArn :: Maybe Text
description :: Maybe Text
creationDateTime :: Maybe POSIX
algorithmArn :: Maybe Text
$sel:status:Recipe' :: Recipe -> Maybe Text
$sel:recipeType:Recipe' :: Recipe -> Maybe Text
$sel:recipeArn:Recipe' :: Recipe -> Maybe Text
$sel:name:Recipe' :: Recipe -> Maybe Text
$sel:lastUpdatedDateTime:Recipe' :: Recipe -> Maybe POSIX
$sel:featureTransformationArn:Recipe' :: Recipe -> Maybe Text
$sel:description:Recipe' :: Recipe -> Maybe Text
$sel:creationDateTime:Recipe' :: Recipe -> Maybe POSIX
$sel:algorithmArn:Recipe' :: Recipe -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
algorithmArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
featureTransformationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recipeArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recipeType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status