{-# 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-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.ServiceActionDetail 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.ServiceActionDefinitionKey
import Amazonka.ServiceCatalog.Types.ServiceActionSummary

-- | An object containing detailed information about the self-service action.
--
-- /See:/ 'newServiceActionDetail' smart constructor.
data ServiceActionDetail = ServiceActionDetail'
  { -- | A map that defines the self-service action.
    ServiceActionDetail
-> Maybe (HashMap ServiceActionDefinitionKey Text)
definition :: Prelude.Maybe (Prelude.HashMap ServiceActionDefinitionKey Prelude.Text),
    -- | Summary information about the self-service action.
    ServiceActionDetail -> Maybe ServiceActionSummary
serviceActionSummary :: Prelude.Maybe ServiceActionSummary
  }
  deriving (ServiceActionDetail -> ServiceActionDetail -> Bool
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]
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
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. 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:
--
-- 'definition', 'serviceActionDetail_definition' - A map that defines the self-service action.
--
-- 'serviceActionSummary', 'serviceActionDetail_serviceActionSummary' - Summary information about the self-service action.
newServiceActionDetail ::
  ServiceActionDetail
newServiceActionDetail :: ServiceActionDetail
newServiceActionDetail =
  ServiceActionDetail'
    { $sel:definition:ServiceActionDetail' :: Maybe (HashMap ServiceActionDefinitionKey Text)
definition = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceActionSummary:ServiceActionDetail' :: Maybe ServiceActionSummary
serviceActionSummary = forall a. Maybe a
Prelude.Nothing
    }

-- | A map that defines the self-service action.
serviceActionDetail_definition :: Lens.Lens' ServiceActionDetail (Prelude.Maybe (Prelude.HashMap ServiceActionDefinitionKey Prelude.Text))
serviceActionDetail_definition :: Lens'
  ServiceActionDetail
  (Maybe (HashMap ServiceActionDefinitionKey Text))
serviceActionDetail_definition = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Summary information about the self-service action.
serviceActionDetail_serviceActionSummary :: Lens.Lens' ServiceActionDetail (Prelude.Maybe ServiceActionSummary)
serviceActionDetail_serviceActionSummary :: Lens' ServiceActionDetail (Maybe ServiceActionSummary)
serviceActionDetail_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)

instance Data.FromJSON ServiceActionDetail where
  parseJSON :: Value -> Parser ServiceActionDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServiceActionDetail"
      ( \Object
x ->
          Maybe (HashMap ServiceActionDefinitionKey Text)
-> Maybe ServiceActionSummary -> ServiceActionDetail
ServiceActionDetail'
            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
"Definition" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ServiceActionSummary")
      )

instance Prelude.Hashable ServiceActionDetail where
  hashWithSalt :: Int -> ServiceActionDetail -> Int
hashWithSalt Int
_salt ServiceActionDetail' {Maybe (HashMap ServiceActionDefinitionKey Text)
Maybe ServiceActionSummary
serviceActionSummary :: Maybe ServiceActionSummary
definition :: Maybe (HashMap ServiceActionDefinitionKey Text)
$sel:serviceActionSummary:ServiceActionDetail' :: ServiceActionDetail -> Maybe ServiceActionSummary
$sel:definition:ServiceActionDetail' :: ServiceActionDetail
-> Maybe (HashMap ServiceActionDefinitionKey Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap ServiceActionDefinitionKey Text)
definition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceActionSummary
serviceActionSummary

instance Prelude.NFData ServiceActionDetail where
  rnf :: ServiceActionDetail -> ()
rnf ServiceActionDetail' {Maybe (HashMap ServiceActionDefinitionKey Text)
Maybe ServiceActionSummary
serviceActionSummary :: Maybe ServiceActionSummary
definition :: Maybe (HashMap ServiceActionDefinitionKey Text)
$sel:serviceActionSummary:ServiceActionDetail' :: ServiceActionDetail -> Maybe ServiceActionSummary
$sel:definition:ServiceActionDetail' :: ServiceActionDetail
-> Maybe (HashMap ServiceActionDefinitionKey Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap ServiceActionDefinitionKey Text)
definition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceActionSummary
serviceActionSummary