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

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

-- | Provides a summary of the properties of a recipe. For a complete
-- listing, call the DescribeRecipe API.
--
-- /See:/ 'newRecipeSummary' smart constructor.
data RecipeSummary = RecipeSummary'
  { -- | The status of the recipe.
    RecipeSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the recipe.
    RecipeSummary -> Maybe Text
recipeArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the recipe was last updated.
    RecipeSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the recipe.
    RecipeSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the recipe was created.
    RecipeSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (RecipeSummary -> RecipeSummary -> Bool
(RecipeSummary -> RecipeSummary -> Bool)
-> (RecipeSummary -> RecipeSummary -> Bool) -> Eq RecipeSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecipeSummary -> RecipeSummary -> Bool
$c/= :: RecipeSummary -> RecipeSummary -> Bool
== :: RecipeSummary -> RecipeSummary -> Bool
$c== :: RecipeSummary -> RecipeSummary -> Bool
Prelude.Eq, ReadPrec [RecipeSummary]
ReadPrec RecipeSummary
Int -> ReadS RecipeSummary
ReadS [RecipeSummary]
(Int -> ReadS RecipeSummary)
-> ReadS [RecipeSummary]
-> ReadPrec RecipeSummary
-> ReadPrec [RecipeSummary]
-> Read RecipeSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecipeSummary]
$creadListPrec :: ReadPrec [RecipeSummary]
readPrec :: ReadPrec RecipeSummary
$creadPrec :: ReadPrec RecipeSummary
readList :: ReadS [RecipeSummary]
$creadList :: ReadS [RecipeSummary]
readsPrec :: Int -> ReadS RecipeSummary
$creadsPrec :: Int -> ReadS RecipeSummary
Prelude.Read, Int -> RecipeSummary -> ShowS
[RecipeSummary] -> ShowS
RecipeSummary -> String
(Int -> RecipeSummary -> ShowS)
-> (RecipeSummary -> String)
-> ([RecipeSummary] -> ShowS)
-> Show RecipeSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecipeSummary] -> ShowS
$cshowList :: [RecipeSummary] -> ShowS
show :: RecipeSummary -> String
$cshow :: RecipeSummary -> String
showsPrec :: Int -> RecipeSummary -> ShowS
$cshowsPrec :: Int -> RecipeSummary -> ShowS
Prelude.Show, (forall x. RecipeSummary -> Rep RecipeSummary x)
-> (forall x. Rep RecipeSummary x -> RecipeSummary)
-> Generic RecipeSummary
forall x. Rep RecipeSummary x -> RecipeSummary
forall x. RecipeSummary -> Rep RecipeSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecipeSummary x -> RecipeSummary
$cfrom :: forall x. RecipeSummary -> Rep RecipeSummary x
Prelude.Generic)

-- |
-- Create a value of 'RecipeSummary' 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', 'recipeSummary_status' - The status of the recipe.
--
-- 'recipeArn', 'recipeSummary_recipeArn' - The Amazon Resource Name (ARN) of the recipe.
--
-- 'lastUpdatedDateTime', 'recipeSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the recipe was last updated.
--
-- 'name', 'recipeSummary_name' - The name of the recipe.
--
-- 'creationDateTime', 'recipeSummary_creationDateTime' - The date and time (in Unix time) that the recipe was created.
newRecipeSummary ::
  RecipeSummary
newRecipeSummary :: RecipeSummary
newRecipeSummary =
  RecipeSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> RecipeSummary
RecipeSummary'
    { $sel:status:RecipeSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recipeArn:RecipeSummary' :: Maybe Text
recipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:RecipeSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RecipeSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:RecipeSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The date and time (in Unix time) that the recipe was last updated.
recipeSummary_lastUpdatedDateTime :: Lens.Lens' RecipeSummary (Prelude.Maybe Prelude.UTCTime)
recipeSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecipeSummary -> f RecipeSummary
recipeSummary_lastUpdatedDateTime = (RecipeSummary -> Maybe POSIX)
-> (RecipeSummary -> Maybe POSIX -> RecipeSummary)
-> Lens RecipeSummary RecipeSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipeSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:RecipeSummary' :: RecipeSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: RecipeSummary
s@RecipeSummary' {} Maybe POSIX
a -> RecipeSummary
s {$sel:lastUpdatedDateTime:RecipeSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: RecipeSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecipeSummary -> f RecipeSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecipeSummary
-> f RecipeSummary
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.
recipeSummary_name :: Lens.Lens' RecipeSummary (Prelude.Maybe Prelude.Text)
recipeSummary_name :: (Maybe Text -> f (Maybe Text)) -> RecipeSummary -> f RecipeSummary
recipeSummary_name = (RecipeSummary -> Maybe Text)
-> (RecipeSummary -> Maybe Text -> RecipeSummary)
-> Lens RecipeSummary RecipeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipeSummary' {Maybe Text
name :: Maybe Text
$sel:name:RecipeSummary' :: RecipeSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: RecipeSummary
s@RecipeSummary' {} Maybe Text
a -> RecipeSummary
s {$sel:name:RecipeSummary' :: Maybe Text
name = Maybe Text
a} :: RecipeSummary)

-- | The date and time (in Unix time) that the recipe was created.
recipeSummary_creationDateTime :: Lens.Lens' RecipeSummary (Prelude.Maybe Prelude.UTCTime)
recipeSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecipeSummary -> f RecipeSummary
recipeSummary_creationDateTime = (RecipeSummary -> Maybe POSIX)
-> (RecipeSummary -> Maybe POSIX -> RecipeSummary)
-> Lens RecipeSummary RecipeSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipeSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:RecipeSummary' :: RecipeSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: RecipeSummary
s@RecipeSummary' {} Maybe POSIX
a -> RecipeSummary
s {$sel:creationDateTime:RecipeSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: RecipeSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecipeSummary -> f RecipeSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecipeSummary
-> f RecipeSummary
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

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

instance Prelude.Hashable RecipeSummary

instance Prelude.NFData RecipeSummary