{-# 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.SolutionSummary
-- 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.SolutionSummary 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 solution. For a complete
-- listing, call the DescribeSolution API.
--
-- /See:/ 'newSolutionSummary' smart constructor.
data SolutionSummary = SolutionSummary'
  { -- | The Amazon Resource Name (ARN) of the solution.
    SolutionSummary -> Maybe Text
solutionArn :: Prelude.Maybe Prelude.Text,
    -- | The status of the solution.
    --
    -- A solution can be in one of the following states:
    --
    -- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
    --
    -- -   DELETE PENDING > DELETE IN_PROGRESS
    SolutionSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the solution was last updated.
    SolutionSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the solution.
    SolutionSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the solution was created.
    SolutionSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (SolutionSummary -> SolutionSummary -> Bool
(SolutionSummary -> SolutionSummary -> Bool)
-> (SolutionSummary -> SolutionSummary -> Bool)
-> Eq SolutionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SolutionSummary -> SolutionSummary -> Bool
$c/= :: SolutionSummary -> SolutionSummary -> Bool
== :: SolutionSummary -> SolutionSummary -> Bool
$c== :: SolutionSummary -> SolutionSummary -> Bool
Prelude.Eq, ReadPrec [SolutionSummary]
ReadPrec SolutionSummary
Int -> ReadS SolutionSummary
ReadS [SolutionSummary]
(Int -> ReadS SolutionSummary)
-> ReadS [SolutionSummary]
-> ReadPrec SolutionSummary
-> ReadPrec [SolutionSummary]
-> Read SolutionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SolutionSummary]
$creadListPrec :: ReadPrec [SolutionSummary]
readPrec :: ReadPrec SolutionSummary
$creadPrec :: ReadPrec SolutionSummary
readList :: ReadS [SolutionSummary]
$creadList :: ReadS [SolutionSummary]
readsPrec :: Int -> ReadS SolutionSummary
$creadsPrec :: Int -> ReadS SolutionSummary
Prelude.Read, Int -> SolutionSummary -> ShowS
[SolutionSummary] -> ShowS
SolutionSummary -> String
(Int -> SolutionSummary -> ShowS)
-> (SolutionSummary -> String)
-> ([SolutionSummary] -> ShowS)
-> Show SolutionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SolutionSummary] -> ShowS
$cshowList :: [SolutionSummary] -> ShowS
show :: SolutionSummary -> String
$cshow :: SolutionSummary -> String
showsPrec :: Int -> SolutionSummary -> ShowS
$cshowsPrec :: Int -> SolutionSummary -> ShowS
Prelude.Show, (forall x. SolutionSummary -> Rep SolutionSummary x)
-> (forall x. Rep SolutionSummary x -> SolutionSummary)
-> Generic SolutionSummary
forall x. Rep SolutionSummary x -> SolutionSummary
forall x. SolutionSummary -> Rep SolutionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SolutionSummary x -> SolutionSummary
$cfrom :: forall x. SolutionSummary -> Rep SolutionSummary x
Prelude.Generic)

-- |
-- Create a value of 'SolutionSummary' 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:
--
-- 'solutionArn', 'solutionSummary_solutionArn' - The Amazon Resource Name (ARN) of the solution.
--
-- 'status', 'solutionSummary_status' - The status of the solution.
--
-- A solution can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
--
-- 'lastUpdatedDateTime', 'solutionSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the solution was last updated.
--
-- 'name', 'solutionSummary_name' - The name of the solution.
--
-- 'creationDateTime', 'solutionSummary_creationDateTime' - The date and time (in Unix time) that the solution was created.
newSolutionSummary ::
  SolutionSummary
newSolutionSummary :: SolutionSummary
newSolutionSummary =
  SolutionSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> SolutionSummary
SolutionSummary'
    { $sel:solutionArn:SolutionSummary' :: Maybe Text
solutionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:SolutionSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:SolutionSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SolutionSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:SolutionSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The status of the solution.
--
-- A solution can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
solutionSummary_status :: Lens.Lens' SolutionSummary (Prelude.Maybe Prelude.Text)
solutionSummary_status :: (Maybe Text -> f (Maybe Text))
-> SolutionSummary -> f SolutionSummary
solutionSummary_status = (SolutionSummary -> Maybe Text)
-> (SolutionSummary -> Maybe Text -> SolutionSummary)
-> Lens SolutionSummary SolutionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionSummary' {Maybe Text
status :: Maybe Text
$sel:status:SolutionSummary' :: SolutionSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: SolutionSummary
s@SolutionSummary' {} Maybe Text
a -> SolutionSummary
s {$sel:status:SolutionSummary' :: Maybe Text
status = Maybe Text
a} :: SolutionSummary)

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

-- | The date and time (in Unix time) that the solution was created.
solutionSummary_creationDateTime :: Lens.Lens' SolutionSummary (Prelude.Maybe Prelude.UTCTime)
solutionSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionSummary -> f SolutionSummary
solutionSummary_creationDateTime = (SolutionSummary -> Maybe POSIX)
-> (SolutionSummary -> Maybe POSIX -> SolutionSummary)
-> Lens SolutionSummary SolutionSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:SolutionSummary' :: SolutionSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: SolutionSummary
s@SolutionSummary' {} Maybe POSIX
a -> SolutionSummary
s {$sel:creationDateTime:SolutionSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: SolutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> SolutionSummary -> f SolutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionSummary
-> f SolutionSummary
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 SolutionSummary where
  parseJSON :: Value -> Parser SolutionSummary
parseJSON =
    String
-> (Object -> Parser SolutionSummary)
-> Value
-> Parser SolutionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SolutionSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> SolutionSummary
SolutionSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> SolutionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> SolutionSummary)
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
"solutionArn")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> SolutionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe POSIX -> SolutionSummary)
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
"status")
            Parser
  (Maybe POSIX -> Maybe Text -> Maybe POSIX -> SolutionSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> SolutionSummary)
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 -> SolutionSummary)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> SolutionSummary)
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 -> SolutionSummary)
-> Parser (Maybe POSIX) -> Parser SolutionSummary
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 SolutionSummary

instance Prelude.NFData SolutionSummary