{-# 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.ServiceCatalog.Types.ProductViewDetail
-- 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.ServiceCatalog.Types.ProductViewDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ServiceCatalog.Types.ProductViewSummary
import Amazonka.ServiceCatalog.Types.RequestStatus

-- | Information about a product view.
--
-- /See:/ 'newProductViewDetail' smart constructor.
data ProductViewDetail = ProductViewDetail'
  { -- | The status of the product.
    --
    -- -   @AVAILABLE@ - The product is ready for use.
    --
    -- -   @CREATING@ - Product creation has started; the product is not ready
    --     for use.
    --
    -- -   @FAILED@ - An action failed.
    ProductViewDetail -> Maybe RequestStatus
status :: Prelude.Maybe RequestStatus,
    -- | Summary information about the product view.
    ProductViewDetail -> Maybe ProductViewSummary
productViewSummary :: Prelude.Maybe ProductViewSummary,
    -- | The UTC time stamp of the creation time.
    ProductViewDetail -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the product.
    ProductViewDetail -> Maybe Text
productARN :: Prelude.Maybe Prelude.Text
  }
  deriving (ProductViewDetail -> ProductViewDetail -> Bool
(ProductViewDetail -> ProductViewDetail -> Bool)
-> (ProductViewDetail -> ProductViewDetail -> Bool)
-> Eq ProductViewDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductViewDetail -> ProductViewDetail -> Bool
$c/= :: ProductViewDetail -> ProductViewDetail -> Bool
== :: ProductViewDetail -> ProductViewDetail -> Bool
$c== :: ProductViewDetail -> ProductViewDetail -> Bool
Prelude.Eq, ReadPrec [ProductViewDetail]
ReadPrec ProductViewDetail
Int -> ReadS ProductViewDetail
ReadS [ProductViewDetail]
(Int -> ReadS ProductViewDetail)
-> ReadS [ProductViewDetail]
-> ReadPrec ProductViewDetail
-> ReadPrec [ProductViewDetail]
-> Read ProductViewDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductViewDetail]
$creadListPrec :: ReadPrec [ProductViewDetail]
readPrec :: ReadPrec ProductViewDetail
$creadPrec :: ReadPrec ProductViewDetail
readList :: ReadS [ProductViewDetail]
$creadList :: ReadS [ProductViewDetail]
readsPrec :: Int -> ReadS ProductViewDetail
$creadsPrec :: Int -> ReadS ProductViewDetail
Prelude.Read, Int -> ProductViewDetail -> ShowS
[ProductViewDetail] -> ShowS
ProductViewDetail -> String
(Int -> ProductViewDetail -> ShowS)
-> (ProductViewDetail -> String)
-> ([ProductViewDetail] -> ShowS)
-> Show ProductViewDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductViewDetail] -> ShowS
$cshowList :: [ProductViewDetail] -> ShowS
show :: ProductViewDetail -> String
$cshow :: ProductViewDetail -> String
showsPrec :: Int -> ProductViewDetail -> ShowS
$cshowsPrec :: Int -> ProductViewDetail -> ShowS
Prelude.Show, (forall x. ProductViewDetail -> Rep ProductViewDetail x)
-> (forall x. Rep ProductViewDetail x -> ProductViewDetail)
-> Generic ProductViewDetail
forall x. Rep ProductViewDetail x -> ProductViewDetail
forall x. ProductViewDetail -> Rep ProductViewDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductViewDetail x -> ProductViewDetail
$cfrom :: forall x. ProductViewDetail -> Rep ProductViewDetail x
Prelude.Generic)

-- |
-- Create a value of 'ProductViewDetail' 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', 'productViewDetail_status' - The status of the product.
--
-- -   @AVAILABLE@ - The product is ready for use.
--
-- -   @CREATING@ - Product creation has started; the product is not ready
--     for use.
--
-- -   @FAILED@ - An action failed.
--
-- 'productViewSummary', 'productViewDetail_productViewSummary' - Summary information about the product view.
--
-- 'createdTime', 'productViewDetail_createdTime' - The UTC time stamp of the creation time.
--
-- 'productARN', 'productViewDetail_productARN' - The ARN of the product.
newProductViewDetail ::
  ProductViewDetail
newProductViewDetail :: ProductViewDetail
newProductViewDetail =
  ProductViewDetail' :: Maybe RequestStatus
-> Maybe ProductViewSummary
-> Maybe POSIX
-> Maybe Text
-> ProductViewDetail
ProductViewDetail'
    { $sel:status:ProductViewDetail' :: Maybe RequestStatus
status = Maybe RequestStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:productViewSummary:ProductViewDetail' :: Maybe ProductViewSummary
productViewSummary = Maybe ProductViewSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:ProductViewDetail' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:productARN:ProductViewDetail' :: Maybe Text
productARN = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the product.
--
-- -   @AVAILABLE@ - The product is ready for use.
--
-- -   @CREATING@ - Product creation has started; the product is not ready
--     for use.
--
-- -   @FAILED@ - An action failed.
productViewDetail_status :: Lens.Lens' ProductViewDetail (Prelude.Maybe RequestStatus)
productViewDetail_status :: (Maybe RequestStatus -> f (Maybe RequestStatus))
-> ProductViewDetail -> f ProductViewDetail
productViewDetail_status = (ProductViewDetail -> Maybe RequestStatus)
-> (ProductViewDetail -> Maybe RequestStatus -> ProductViewDetail)
-> Lens
     ProductViewDetail
     ProductViewDetail
     (Maybe RequestStatus)
     (Maybe RequestStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductViewDetail' {Maybe RequestStatus
status :: Maybe RequestStatus
$sel:status:ProductViewDetail' :: ProductViewDetail -> Maybe RequestStatus
status} -> Maybe RequestStatus
status) (\s :: ProductViewDetail
s@ProductViewDetail' {} Maybe RequestStatus
a -> ProductViewDetail
s {$sel:status:ProductViewDetail' :: Maybe RequestStatus
status = Maybe RequestStatus
a} :: ProductViewDetail)

-- | Summary information about the product view.
productViewDetail_productViewSummary :: Lens.Lens' ProductViewDetail (Prelude.Maybe ProductViewSummary)
productViewDetail_productViewSummary :: (Maybe ProductViewSummary -> f (Maybe ProductViewSummary))
-> ProductViewDetail -> f ProductViewDetail
productViewDetail_productViewSummary = (ProductViewDetail -> Maybe ProductViewSummary)
-> (ProductViewDetail
    -> Maybe ProductViewSummary -> ProductViewDetail)
-> Lens
     ProductViewDetail
     ProductViewDetail
     (Maybe ProductViewSummary)
     (Maybe ProductViewSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductViewDetail' {Maybe ProductViewSummary
productViewSummary :: Maybe ProductViewSummary
$sel:productViewSummary:ProductViewDetail' :: ProductViewDetail -> Maybe ProductViewSummary
productViewSummary} -> Maybe ProductViewSummary
productViewSummary) (\s :: ProductViewDetail
s@ProductViewDetail' {} Maybe ProductViewSummary
a -> ProductViewDetail
s {$sel:productViewSummary:ProductViewDetail' :: Maybe ProductViewSummary
productViewSummary = Maybe ProductViewSummary
a} :: ProductViewDetail)

-- | The UTC time stamp of the creation time.
productViewDetail_createdTime :: Lens.Lens' ProductViewDetail (Prelude.Maybe Prelude.UTCTime)
productViewDetail_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProductViewDetail -> f ProductViewDetail
productViewDetail_createdTime = (ProductViewDetail -> Maybe POSIX)
-> (ProductViewDetail -> Maybe POSIX -> ProductViewDetail)
-> Lens
     ProductViewDetail ProductViewDetail (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductViewDetail' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:ProductViewDetail' :: ProductViewDetail -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: ProductViewDetail
s@ProductViewDetail' {} Maybe POSIX
a -> ProductViewDetail
s {$sel:createdTime:ProductViewDetail' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: ProductViewDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProductViewDetail -> f ProductViewDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProductViewDetail
-> f ProductViewDetail
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 ARN of the product.
productViewDetail_productARN :: Lens.Lens' ProductViewDetail (Prelude.Maybe Prelude.Text)
productViewDetail_productARN :: (Maybe Text -> f (Maybe Text))
-> ProductViewDetail -> f ProductViewDetail
productViewDetail_productARN = (ProductViewDetail -> Maybe Text)
-> (ProductViewDetail -> Maybe Text -> ProductViewDetail)
-> Lens
     ProductViewDetail ProductViewDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductViewDetail' {Maybe Text
productARN :: Maybe Text
$sel:productARN:ProductViewDetail' :: ProductViewDetail -> Maybe Text
productARN} -> Maybe Text
productARN) (\s :: ProductViewDetail
s@ProductViewDetail' {} Maybe Text
a -> ProductViewDetail
s {$sel:productARN:ProductViewDetail' :: Maybe Text
productARN = Maybe Text
a} :: ProductViewDetail)

instance Core.FromJSON ProductViewDetail where
  parseJSON :: Value -> Parser ProductViewDetail
parseJSON =
    String
-> (Object -> Parser ProductViewDetail)
-> Value
-> Parser ProductViewDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProductViewDetail"
      ( \Object
x ->
          Maybe RequestStatus
-> Maybe ProductViewSummary
-> Maybe POSIX
-> Maybe Text
-> ProductViewDetail
ProductViewDetail'
            (Maybe RequestStatus
 -> Maybe ProductViewSummary
 -> Maybe POSIX
 -> Maybe Text
 -> ProductViewDetail)
-> Parser (Maybe RequestStatus)
-> Parser
     (Maybe ProductViewSummary
      -> Maybe POSIX -> Maybe Text -> ProductViewDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RequestStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe ProductViewSummary
   -> Maybe POSIX -> Maybe Text -> ProductViewDetail)
-> Parser (Maybe ProductViewSummary)
-> Parser (Maybe POSIX -> Maybe Text -> ProductViewDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProductViewSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProductViewSummary")
            Parser (Maybe POSIX -> Maybe Text -> ProductViewDetail)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> ProductViewDetail)
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
"CreatedTime")
            Parser (Maybe Text -> ProductViewDetail)
-> Parser (Maybe Text) -> Parser ProductViewDetail
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
"ProductARN")
      )

instance Prelude.Hashable ProductViewDetail

instance Prelude.NFData ProductViewDetail