{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ServiceCatalog.Types.ProductViewDetail 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
import Amazonka.ServiceCatalog.Types.ProductViewSummary
import Amazonka.ServiceCatalog.Types.RequestStatus
import Amazonka.ServiceCatalog.Types.SourceConnectionDetail

-- | Information about a product view.
--
-- /See:/ 'newProductViewDetail' smart constructor.
data ProductViewDetail = ProductViewDetail'
  { -- | The UTC time stamp of the creation time.
    ProductViewDetail -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The ARN of the product.
    ProductViewDetail -> Maybe Text
productARN :: Prelude.Maybe Prelude.Text,
    -- | Summary information about the product view.
    ProductViewDetail -> Maybe ProductViewSummary
productViewSummary :: Prelude.Maybe ProductViewSummary,
    -- | A top level @ProductViewDetail@ response containing details about the
    -- product’s connection. Service Catalog returns this field for the
    -- @CreateProduct@, @UpdateProduct@, @DescribeProductAsAdmin@, and
    -- @SearchProductAsAdmin@ APIs. This response contains the same fields as
    -- the @ConnectionParameters@ request, with the addition of the @LastSync@
    -- response.
    ProductViewDetail -> Maybe SourceConnectionDetail
sourceConnection :: Prelude.Maybe SourceConnectionDetail,
    -- | 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
  }
  deriving (ProductViewDetail -> ProductViewDetail -> Bool
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]
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
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. 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:
--
-- 'createdTime', 'productViewDetail_createdTime' - The UTC time stamp of the creation time.
--
-- 'productARN', 'productViewDetail_productARN' - The ARN of the product.
--
-- 'productViewSummary', 'productViewDetail_productViewSummary' - Summary information about the product view.
--
-- 'sourceConnection', 'productViewDetail_sourceConnection' - A top level @ProductViewDetail@ response containing details about the
-- product’s connection. Service Catalog returns this field for the
-- @CreateProduct@, @UpdateProduct@, @DescribeProductAsAdmin@, and
-- @SearchProductAsAdmin@ APIs. This response contains the same fields as
-- the @ConnectionParameters@ request, with the addition of the @LastSync@
-- response.
--
-- '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.
newProductViewDetail ::
  ProductViewDetail
newProductViewDetail :: ProductViewDetail
newProductViewDetail =
  ProductViewDetail'
    { $sel:createdTime:ProductViewDetail' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:productARN:ProductViewDetail' :: Maybe Text
productARN = forall a. Maybe a
Prelude.Nothing,
      $sel:productViewSummary:ProductViewDetail' :: Maybe ProductViewSummary
productViewSummary = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceConnection:ProductViewDetail' :: Maybe SourceConnectionDetail
sourceConnection = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ProductViewDetail' :: Maybe RequestStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The UTC time stamp of the creation time.
productViewDetail_createdTime :: Lens.Lens' ProductViewDetail (Prelude.Maybe Prelude.UTCTime)
productViewDetail_createdTime :: Lens' ProductViewDetail (Maybe UTCTime)
productViewDetail_createdTime = 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) 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 ARN of the product.
productViewDetail_productARN :: Lens.Lens' ProductViewDetail (Prelude.Maybe Prelude.Text)
productViewDetail_productARN :: Lens' ProductViewDetail (Maybe Text)
productViewDetail_productARN = 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)

-- | Summary information about the product view.
productViewDetail_productViewSummary :: Lens.Lens' ProductViewDetail (Prelude.Maybe ProductViewSummary)
productViewDetail_productViewSummary :: Lens' ProductViewDetail (Maybe ProductViewSummary)
productViewDetail_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)

-- | A top level @ProductViewDetail@ response containing details about the
-- product’s connection. Service Catalog returns this field for the
-- @CreateProduct@, @UpdateProduct@, @DescribeProductAsAdmin@, and
-- @SearchProductAsAdmin@ APIs. This response contains the same fields as
-- the @ConnectionParameters@ request, with the addition of the @LastSync@
-- response.
productViewDetail_sourceConnection :: Lens.Lens' ProductViewDetail (Prelude.Maybe SourceConnectionDetail)
productViewDetail_sourceConnection :: Lens' ProductViewDetail (Maybe SourceConnectionDetail)
productViewDetail_sourceConnection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductViewDetail' {Maybe SourceConnectionDetail
sourceConnection :: Maybe SourceConnectionDetail
$sel:sourceConnection:ProductViewDetail' :: ProductViewDetail -> Maybe SourceConnectionDetail
sourceConnection} -> Maybe SourceConnectionDetail
sourceConnection) (\s :: ProductViewDetail
s@ProductViewDetail' {} Maybe SourceConnectionDetail
a -> ProductViewDetail
s {$sel:sourceConnection:ProductViewDetail' :: Maybe SourceConnectionDetail
sourceConnection = Maybe SourceConnectionDetail
a} :: 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_status :: Lens.Lens' ProductViewDetail (Prelude.Maybe RequestStatus)
productViewDetail_status :: Lens' ProductViewDetail (Maybe RequestStatus)
productViewDetail_status = 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)

instance Data.FromJSON ProductViewDetail where
  parseJSON :: Value -> Parser ProductViewDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProductViewDetail"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe ProductViewSummary
-> Maybe SourceConnectionDetail
-> Maybe RequestStatus
-> ProductViewDetail
ProductViewDetail'
            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
"CreatedTime")
            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
"ProductARN")
            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
"ProductViewSummary")
            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
"SourceConnection")
            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 ProductViewDetail where
  hashWithSalt :: Int -> ProductViewDetail -> Int
hashWithSalt Int
_salt ProductViewDetail' {Maybe Text
Maybe POSIX
Maybe ProductViewSummary
Maybe RequestStatus
Maybe SourceConnectionDetail
status :: Maybe RequestStatus
sourceConnection :: Maybe SourceConnectionDetail
productViewSummary :: Maybe ProductViewSummary
productARN :: Maybe Text
createdTime :: Maybe POSIX
$sel:status:ProductViewDetail' :: ProductViewDetail -> Maybe RequestStatus
$sel:sourceConnection:ProductViewDetail' :: ProductViewDetail -> Maybe SourceConnectionDetail
$sel:productViewSummary:ProductViewDetail' :: ProductViewDetail -> Maybe ProductViewSummary
$sel:productARN:ProductViewDetail' :: ProductViewDetail -> Maybe Text
$sel:createdTime:ProductViewDetail' :: ProductViewDetail -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
productARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProductViewSummary
productViewSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SourceConnectionDetail
sourceConnection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RequestStatus
status

instance Prelude.NFData ProductViewDetail where
  rnf :: ProductViewDetail -> ()
rnf ProductViewDetail' {Maybe Text
Maybe POSIX
Maybe ProductViewSummary
Maybe RequestStatus
Maybe SourceConnectionDetail
status :: Maybe RequestStatus
sourceConnection :: Maybe SourceConnectionDetail
productViewSummary :: Maybe ProductViewSummary
productARN :: Maybe Text
createdTime :: Maybe POSIX
$sel:status:ProductViewDetail' :: ProductViewDetail -> Maybe RequestStatus
$sel:sourceConnection:ProductViewDetail' :: ProductViewDetail -> Maybe SourceConnectionDetail
$sel:productViewSummary:ProductViewDetail' :: ProductViewDetail -> Maybe ProductViewSummary
$sel:productARN:ProductViewDetail' :: ProductViewDetail -> Maybe Text
$sel:createdTime:ProductViewDetail' :: ProductViewDetail -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
productARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProductViewSummary
productViewSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceConnectionDetail
sourceConnection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RequestStatus
status