{-# 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.ResilienceHub.Types.SopRecommendation
-- 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.ResilienceHub.Types.SopRecommendation 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.ResilienceHub.Types.RecommendationItem
import Amazonka.ResilienceHub.Types.SopServiceType

-- | Defines a standard operating procedure (SOP) recommendation.
--
-- /See:/ 'newSopRecommendation' smart constructor.
data SopRecommendation = SopRecommendation'
  { -- | The application component name.
    SopRecommendation -> Maybe Text
appComponentName :: Prelude.Maybe Prelude.Text,
    -- | The description of the SOP recommendation.
    SopRecommendation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The recommendation items.
    SopRecommendation -> Maybe [RecommendationItem]
items :: Prelude.Maybe [RecommendationItem],
    -- | The name of the SOP recommendation.
    SopRecommendation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The prerequisite for the SOP recommendation.
    SopRecommendation -> Maybe Text
prerequisite :: Prelude.Maybe Prelude.Text,
    -- | Identifier for the SOP recommendation.
    SopRecommendation -> Text
recommendationId :: Prelude.Text,
    -- | The reference identifier for the SOP recommendation.
    SopRecommendation -> Text
referenceId :: Prelude.Text,
    -- | The service type.
    SopRecommendation -> SopServiceType
serviceType :: SopServiceType
  }
  deriving (SopRecommendation -> SopRecommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SopRecommendation -> SopRecommendation -> Bool
$c/= :: SopRecommendation -> SopRecommendation -> Bool
== :: SopRecommendation -> SopRecommendation -> Bool
$c== :: SopRecommendation -> SopRecommendation -> Bool
Prelude.Eq, ReadPrec [SopRecommendation]
ReadPrec SopRecommendation
Int -> ReadS SopRecommendation
ReadS [SopRecommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SopRecommendation]
$creadListPrec :: ReadPrec [SopRecommendation]
readPrec :: ReadPrec SopRecommendation
$creadPrec :: ReadPrec SopRecommendation
readList :: ReadS [SopRecommendation]
$creadList :: ReadS [SopRecommendation]
readsPrec :: Int -> ReadS SopRecommendation
$creadsPrec :: Int -> ReadS SopRecommendation
Prelude.Read, Int -> SopRecommendation -> ShowS
[SopRecommendation] -> ShowS
SopRecommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SopRecommendation] -> ShowS
$cshowList :: [SopRecommendation] -> ShowS
show :: SopRecommendation -> String
$cshow :: SopRecommendation -> String
showsPrec :: Int -> SopRecommendation -> ShowS
$cshowsPrec :: Int -> SopRecommendation -> ShowS
Prelude.Show, forall x. Rep SopRecommendation x -> SopRecommendation
forall x. SopRecommendation -> Rep SopRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SopRecommendation x -> SopRecommendation
$cfrom :: forall x. SopRecommendation -> Rep SopRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'SopRecommendation' 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:
--
-- 'appComponentName', 'sopRecommendation_appComponentName' - The application component name.
--
-- 'description', 'sopRecommendation_description' - The description of the SOP recommendation.
--
-- 'items', 'sopRecommendation_items' - The recommendation items.
--
-- 'name', 'sopRecommendation_name' - The name of the SOP recommendation.
--
-- 'prerequisite', 'sopRecommendation_prerequisite' - The prerequisite for the SOP recommendation.
--
-- 'recommendationId', 'sopRecommendation_recommendationId' - Identifier for the SOP recommendation.
--
-- 'referenceId', 'sopRecommendation_referenceId' - The reference identifier for the SOP recommendation.
--
-- 'serviceType', 'sopRecommendation_serviceType' - The service type.
newSopRecommendation ::
  -- | 'recommendationId'
  Prelude.Text ->
  -- | 'referenceId'
  Prelude.Text ->
  -- | 'serviceType'
  SopServiceType ->
  SopRecommendation
newSopRecommendation :: Text -> Text -> SopServiceType -> SopRecommendation
newSopRecommendation
  Text
pRecommendationId_
  Text
pReferenceId_
  SopServiceType
pServiceType_ =
    SopRecommendation'
      { $sel:appComponentName:SopRecommendation' :: Maybe Text
appComponentName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:SopRecommendation' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:items:SopRecommendation' :: Maybe [RecommendationItem]
items = forall a. Maybe a
Prelude.Nothing,
        $sel:name:SopRecommendation' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:prerequisite:SopRecommendation' :: Maybe Text
prerequisite = forall a. Maybe a
Prelude.Nothing,
        $sel:recommendationId:SopRecommendation' :: Text
recommendationId = Text
pRecommendationId_,
        $sel:referenceId:SopRecommendation' :: Text
referenceId = Text
pReferenceId_,
        $sel:serviceType:SopRecommendation' :: SopServiceType
serviceType = SopServiceType
pServiceType_
      }

-- | The application component name.
sopRecommendation_appComponentName :: Lens.Lens' SopRecommendation (Prelude.Maybe Prelude.Text)
sopRecommendation_appComponentName :: Lens' SopRecommendation (Maybe Text)
sopRecommendation_appComponentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Maybe Text
appComponentName :: Maybe Text
$sel:appComponentName:SopRecommendation' :: SopRecommendation -> Maybe Text
appComponentName} -> Maybe Text
appComponentName) (\s :: SopRecommendation
s@SopRecommendation' {} Maybe Text
a -> SopRecommendation
s {$sel:appComponentName:SopRecommendation' :: Maybe Text
appComponentName = Maybe Text
a} :: SopRecommendation)

-- | The description of the SOP recommendation.
sopRecommendation_description :: Lens.Lens' SopRecommendation (Prelude.Maybe Prelude.Text)
sopRecommendation_description :: Lens' SopRecommendation (Maybe Text)
sopRecommendation_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Maybe Text
description :: Maybe Text
$sel:description:SopRecommendation' :: SopRecommendation -> Maybe Text
description} -> Maybe Text
description) (\s :: SopRecommendation
s@SopRecommendation' {} Maybe Text
a -> SopRecommendation
s {$sel:description:SopRecommendation' :: Maybe Text
description = Maybe Text
a} :: SopRecommendation)

-- | The recommendation items.
sopRecommendation_items :: Lens.Lens' SopRecommendation (Prelude.Maybe [RecommendationItem])
sopRecommendation_items :: Lens' SopRecommendation (Maybe [RecommendationItem])
sopRecommendation_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Maybe [RecommendationItem]
items :: Maybe [RecommendationItem]
$sel:items:SopRecommendation' :: SopRecommendation -> Maybe [RecommendationItem]
items} -> Maybe [RecommendationItem]
items) (\s :: SopRecommendation
s@SopRecommendation' {} Maybe [RecommendationItem]
a -> SopRecommendation
s {$sel:items:SopRecommendation' :: Maybe [RecommendationItem]
items = Maybe [RecommendationItem]
a} :: SopRecommendation) 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

-- | The name of the SOP recommendation.
sopRecommendation_name :: Lens.Lens' SopRecommendation (Prelude.Maybe Prelude.Text)
sopRecommendation_name :: Lens' SopRecommendation (Maybe Text)
sopRecommendation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Maybe Text
name :: Maybe Text
$sel:name:SopRecommendation' :: SopRecommendation -> Maybe Text
name} -> Maybe Text
name) (\s :: SopRecommendation
s@SopRecommendation' {} Maybe Text
a -> SopRecommendation
s {$sel:name:SopRecommendation' :: Maybe Text
name = Maybe Text
a} :: SopRecommendation)

-- | The prerequisite for the SOP recommendation.
sopRecommendation_prerequisite :: Lens.Lens' SopRecommendation (Prelude.Maybe Prelude.Text)
sopRecommendation_prerequisite :: Lens' SopRecommendation (Maybe Text)
sopRecommendation_prerequisite = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Maybe Text
prerequisite :: Maybe Text
$sel:prerequisite:SopRecommendation' :: SopRecommendation -> Maybe Text
prerequisite} -> Maybe Text
prerequisite) (\s :: SopRecommendation
s@SopRecommendation' {} Maybe Text
a -> SopRecommendation
s {$sel:prerequisite:SopRecommendation' :: Maybe Text
prerequisite = Maybe Text
a} :: SopRecommendation)

-- | Identifier for the SOP recommendation.
sopRecommendation_recommendationId :: Lens.Lens' SopRecommendation Prelude.Text
sopRecommendation_recommendationId :: Lens' SopRecommendation Text
sopRecommendation_recommendationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Text
recommendationId :: Text
$sel:recommendationId:SopRecommendation' :: SopRecommendation -> Text
recommendationId} -> Text
recommendationId) (\s :: SopRecommendation
s@SopRecommendation' {} Text
a -> SopRecommendation
s {$sel:recommendationId:SopRecommendation' :: Text
recommendationId = Text
a} :: SopRecommendation)

-- | The reference identifier for the SOP recommendation.
sopRecommendation_referenceId :: Lens.Lens' SopRecommendation Prelude.Text
sopRecommendation_referenceId :: Lens' SopRecommendation Text
sopRecommendation_referenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {Text
referenceId :: Text
$sel:referenceId:SopRecommendation' :: SopRecommendation -> Text
referenceId} -> Text
referenceId) (\s :: SopRecommendation
s@SopRecommendation' {} Text
a -> SopRecommendation
s {$sel:referenceId:SopRecommendation' :: Text
referenceId = Text
a} :: SopRecommendation)

-- | The service type.
sopRecommendation_serviceType :: Lens.Lens' SopRecommendation SopServiceType
sopRecommendation_serviceType :: Lens' SopRecommendation SopServiceType
sopRecommendation_serviceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SopRecommendation' {SopServiceType
serviceType :: SopServiceType
$sel:serviceType:SopRecommendation' :: SopRecommendation -> SopServiceType
serviceType} -> SopServiceType
serviceType) (\s :: SopRecommendation
s@SopRecommendation' {} SopServiceType
a -> SopRecommendation
s {$sel:serviceType:SopRecommendation' :: SopServiceType
serviceType = SopServiceType
a} :: SopRecommendation)

instance Data.FromJSON SopRecommendation where
  parseJSON :: Value -> Parser SopRecommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SopRecommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [RecommendationItem]
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> SopServiceType
-> SopRecommendation
SopRecommendation'
            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
"appComponentName")
            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
"description")
            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
"items" 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
"name")
            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
"prerequisite")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"recommendationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"referenceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"serviceType")
      )

instance Prelude.Hashable SopRecommendation where
  hashWithSalt :: Int -> SopRecommendation -> Int
hashWithSalt Int
_salt SopRecommendation' {Maybe [RecommendationItem]
Maybe Text
Text
SopServiceType
serviceType :: SopServiceType
referenceId :: Text
recommendationId :: Text
prerequisite :: Maybe Text
name :: Maybe Text
items :: Maybe [RecommendationItem]
description :: Maybe Text
appComponentName :: Maybe Text
$sel:serviceType:SopRecommendation' :: SopRecommendation -> SopServiceType
$sel:referenceId:SopRecommendation' :: SopRecommendation -> Text
$sel:recommendationId:SopRecommendation' :: SopRecommendation -> Text
$sel:prerequisite:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:name:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:items:SopRecommendation' :: SopRecommendation -> Maybe [RecommendationItem]
$sel:description:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:appComponentName:SopRecommendation' :: SopRecommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appComponentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RecommendationItem]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prerequisite
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recommendationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
referenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SopServiceType
serviceType

instance Prelude.NFData SopRecommendation where
  rnf :: SopRecommendation -> ()
rnf SopRecommendation' {Maybe [RecommendationItem]
Maybe Text
Text
SopServiceType
serviceType :: SopServiceType
referenceId :: Text
recommendationId :: Text
prerequisite :: Maybe Text
name :: Maybe Text
items :: Maybe [RecommendationItem]
description :: Maybe Text
appComponentName :: Maybe Text
$sel:serviceType:SopRecommendation' :: SopRecommendation -> SopServiceType
$sel:referenceId:SopRecommendation' :: SopRecommendation -> Text
$sel:recommendationId:SopRecommendation' :: SopRecommendation -> Text
$sel:prerequisite:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:name:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:items:SopRecommendation' :: SopRecommendation -> Maybe [RecommendationItem]
$sel:description:SopRecommendation' :: SopRecommendation -> Maybe Text
$sel:appComponentName:SopRecommendation' :: SopRecommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appComponentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RecommendationItem]
items
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prerequisite
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
recommendationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
referenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SopServiceType
serviceType