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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ServiceCatalog.Types.ServiceActionDefinitionKey
import Amazonka.ServiceCatalog.Types.ServiceActionSummary

-- | An object containing detailed information about the self-service action.
--
-- /See:/ 'newServiceActionDetail' smart constructor.
data ServiceActionDetail = ServiceActionDetail'
  { -- | Summary information about the self-service action.
    ServiceActionDetail -> Maybe ServiceActionSummary
serviceActionSummary :: Prelude.Maybe ServiceActionSummary,
    -- | A map that defines the self-service action.
    ServiceActionDetail
-> Maybe (HashMap ServiceActionDefinitionKey Text)
definition :: Prelude.Maybe (Prelude.HashMap ServiceActionDefinitionKey Prelude.Text)
  }
  deriving (ServiceActionDetail -> ServiceActionDetail -> Bool
(ServiceActionDetail -> ServiceActionDetail -> Bool)
-> (ServiceActionDetail -> ServiceActionDetail -> Bool)
-> Eq ServiceActionDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceActionDetail -> ServiceActionDetail -> Bool
$c/= :: ServiceActionDetail -> ServiceActionDetail -> Bool
== :: ServiceActionDetail -> ServiceActionDetail -> Bool
$c== :: ServiceActionDetail -> ServiceActionDetail -> Bool
Prelude.Eq, ReadPrec [ServiceActionDetail]
ReadPrec ServiceActionDetail
Int -> ReadS ServiceActionDetail
ReadS [ServiceActionDetail]
(Int -> ReadS ServiceActionDetail)
-> ReadS [ServiceActionDetail]
-> ReadPrec ServiceActionDetail
-> ReadPrec [ServiceActionDetail]
-> Read ServiceActionDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceActionDetail]
$creadListPrec :: ReadPrec [ServiceActionDetail]
readPrec :: ReadPrec ServiceActionDetail
$creadPrec :: ReadPrec ServiceActionDetail
readList :: ReadS [ServiceActionDetail]
$creadList :: ReadS [ServiceActionDetail]
readsPrec :: Int -> ReadS ServiceActionDetail
$creadsPrec :: Int -> ReadS ServiceActionDetail
Prelude.Read, Int -> ServiceActionDetail -> ShowS
[ServiceActionDetail] -> ShowS
ServiceActionDetail -> String
(Int -> ServiceActionDetail -> ShowS)
-> (ServiceActionDetail -> String)
-> ([ServiceActionDetail] -> ShowS)
-> Show ServiceActionDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceActionDetail] -> ShowS
$cshowList :: [ServiceActionDetail] -> ShowS
show :: ServiceActionDetail -> String
$cshow :: ServiceActionDetail -> String
showsPrec :: Int -> ServiceActionDetail -> ShowS
$cshowsPrec :: Int -> ServiceActionDetail -> ShowS
Prelude.Show, (forall x. ServiceActionDetail -> Rep ServiceActionDetail x)
-> (forall x. Rep ServiceActionDetail x -> ServiceActionDetail)
-> Generic ServiceActionDetail
forall x. Rep ServiceActionDetail x -> ServiceActionDetail
forall x. ServiceActionDetail -> Rep ServiceActionDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceActionDetail x -> ServiceActionDetail
$cfrom :: forall x. ServiceActionDetail -> Rep ServiceActionDetail x
Prelude.Generic)

-- |
-- Create a value of 'ServiceActionDetail' 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:
--
-- 'serviceActionSummary', 'serviceActionDetail_serviceActionSummary' - Summary information about the self-service action.
--
-- 'definition', 'serviceActionDetail_definition' - A map that defines the self-service action.
newServiceActionDetail ::
  ServiceActionDetail
newServiceActionDetail :: ServiceActionDetail
newServiceActionDetail =
  ServiceActionDetail' :: Maybe ServiceActionSummary
-> Maybe (HashMap ServiceActionDefinitionKey Text)
-> ServiceActionDetail
ServiceActionDetail'
    { $sel:serviceActionSummary:ServiceActionDetail' :: Maybe ServiceActionSummary
serviceActionSummary =
        Maybe ServiceActionSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:definition:ServiceActionDetail' :: Maybe (HashMap ServiceActionDefinitionKey Text)
definition = Maybe (HashMap ServiceActionDefinitionKey Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Summary information about the self-service action.
serviceActionDetail_serviceActionSummary :: Lens.Lens' ServiceActionDetail (Prelude.Maybe ServiceActionSummary)
serviceActionDetail_serviceActionSummary :: (Maybe ServiceActionSummary -> f (Maybe ServiceActionSummary))
-> ServiceActionDetail -> f ServiceActionDetail
serviceActionDetail_serviceActionSummary = (ServiceActionDetail -> Maybe ServiceActionSummary)
-> (ServiceActionDetail
    -> Maybe ServiceActionSummary -> ServiceActionDetail)
-> Lens
     ServiceActionDetail
     ServiceActionDetail
     (Maybe ServiceActionSummary)
     (Maybe ServiceActionSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceActionDetail' {Maybe ServiceActionSummary
serviceActionSummary :: Maybe ServiceActionSummary
$sel:serviceActionSummary:ServiceActionDetail' :: ServiceActionDetail -> Maybe ServiceActionSummary
serviceActionSummary} -> Maybe ServiceActionSummary
serviceActionSummary) (\s :: ServiceActionDetail
s@ServiceActionDetail' {} Maybe ServiceActionSummary
a -> ServiceActionDetail
s {$sel:serviceActionSummary:ServiceActionDetail' :: Maybe ServiceActionSummary
serviceActionSummary = Maybe ServiceActionSummary
a} :: ServiceActionDetail)

-- | A map that defines the self-service action.
serviceActionDetail_definition :: Lens.Lens' ServiceActionDetail (Prelude.Maybe (Prelude.HashMap ServiceActionDefinitionKey Prelude.Text))
serviceActionDetail_definition :: (Maybe (HashMap ServiceActionDefinitionKey Text)
 -> f (Maybe (HashMap ServiceActionDefinitionKey Text)))
-> ServiceActionDetail -> f ServiceActionDetail
serviceActionDetail_definition = (ServiceActionDetail
 -> Maybe (HashMap ServiceActionDefinitionKey Text))
-> (ServiceActionDetail
    -> Maybe (HashMap ServiceActionDefinitionKey Text)
    -> ServiceActionDetail)
-> Lens
     ServiceActionDetail
     ServiceActionDetail
     (Maybe (HashMap ServiceActionDefinitionKey Text))
     (Maybe (HashMap ServiceActionDefinitionKey Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceActionDetail' {Maybe (HashMap ServiceActionDefinitionKey Text)
definition :: Maybe (HashMap ServiceActionDefinitionKey Text)
$sel:definition:ServiceActionDetail' :: ServiceActionDetail
-> Maybe (HashMap ServiceActionDefinitionKey Text)
definition} -> Maybe (HashMap ServiceActionDefinitionKey Text)
definition) (\s :: ServiceActionDetail
s@ServiceActionDetail' {} Maybe (HashMap ServiceActionDefinitionKey Text)
a -> ServiceActionDetail
s {$sel:definition:ServiceActionDetail' :: Maybe (HashMap ServiceActionDefinitionKey Text)
definition = Maybe (HashMap ServiceActionDefinitionKey Text)
a} :: ServiceActionDetail) ((Maybe (HashMap ServiceActionDefinitionKey Text)
  -> f (Maybe (HashMap ServiceActionDefinitionKey Text)))
 -> ServiceActionDetail -> f ServiceActionDetail)
-> ((Maybe (HashMap ServiceActionDefinitionKey Text)
     -> f (Maybe (HashMap ServiceActionDefinitionKey Text)))
    -> Maybe (HashMap ServiceActionDefinitionKey Text)
    -> f (Maybe (HashMap ServiceActionDefinitionKey Text)))
-> (Maybe (HashMap ServiceActionDefinitionKey Text)
    -> f (Maybe (HashMap ServiceActionDefinitionKey Text)))
-> ServiceActionDetail
-> f ServiceActionDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
-> Iso
     (Maybe (HashMap ServiceActionDefinitionKey Text))
     (Maybe (HashMap ServiceActionDefinitionKey Text))
     (Maybe (HashMap ServiceActionDefinitionKey Text))
     (Maybe (HashMap ServiceActionDefinitionKey Text))
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
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
  (HashMap ServiceActionDefinitionKey Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ServiceActionDetail where
  parseJSON :: Value -> Parser ServiceActionDetail
parseJSON =
    String
-> (Object -> Parser ServiceActionDetail)
-> Value
-> Parser ServiceActionDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceActionDetail"
      ( \Object
x ->
          Maybe ServiceActionSummary
-> Maybe (HashMap ServiceActionDefinitionKey Text)
-> ServiceActionDetail
ServiceActionDetail'
            (Maybe ServiceActionSummary
 -> Maybe (HashMap ServiceActionDefinitionKey Text)
 -> ServiceActionDetail)
-> Parser (Maybe ServiceActionSummary)
-> Parser
     (Maybe (HashMap ServiceActionDefinitionKey Text)
      -> ServiceActionDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ServiceActionSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServiceActionSummary")
            Parser
  (Maybe (HashMap ServiceActionDefinitionKey Text)
   -> ServiceActionDetail)
-> Parser (Maybe (HashMap ServiceActionDefinitionKey Text))
-> Parser ServiceActionDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap ServiceActionDefinitionKey Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Definition" Parser (Maybe (Maybe (HashMap ServiceActionDefinitionKey Text)))
-> Maybe (HashMap ServiceActionDefinitionKey Text)
-> Parser (Maybe (HashMap ServiceActionDefinitionKey Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap ServiceActionDefinitionKey Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ServiceActionDetail

instance Prelude.NFData ServiceActionDetail