{-# 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.MigrationHubStrategy.Types.ApplicationComponentStrategy
-- 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.MigrationHubStrategy.Types.ApplicationComponentStrategy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.RecommendationSet
import Amazonka.MigrationHubStrategy.Types.StrategyRecommendation
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a strategy recommendation for an application
-- component.
--
-- /See:/ 'newApplicationComponentStrategy' smart constructor.
data ApplicationComponentStrategy = ApplicationComponentStrategy'
  { -- | Set to true if the recommendation is set as preferred.
    ApplicationComponentStrategy -> Maybe Bool
isPreferred :: Prelude.Maybe Prelude.Bool,
    -- | Strategy recommendation for the application component.
    ApplicationComponentStrategy -> Maybe RecommendationSet
recommendation :: Prelude.Maybe RecommendationSet,
    -- | The recommendation status of a strategy for an application component.
    ApplicationComponentStrategy -> Maybe StrategyRecommendation
status :: Prelude.Maybe StrategyRecommendation
  }
  deriving (ApplicationComponentStrategy
-> ApplicationComponentStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationComponentStrategy
-> ApplicationComponentStrategy -> Bool
$c/= :: ApplicationComponentStrategy
-> ApplicationComponentStrategy -> Bool
== :: ApplicationComponentStrategy
-> ApplicationComponentStrategy -> Bool
$c== :: ApplicationComponentStrategy
-> ApplicationComponentStrategy -> Bool
Prelude.Eq, ReadPrec [ApplicationComponentStrategy]
ReadPrec ApplicationComponentStrategy
Int -> ReadS ApplicationComponentStrategy
ReadS [ApplicationComponentStrategy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationComponentStrategy]
$creadListPrec :: ReadPrec [ApplicationComponentStrategy]
readPrec :: ReadPrec ApplicationComponentStrategy
$creadPrec :: ReadPrec ApplicationComponentStrategy
readList :: ReadS [ApplicationComponentStrategy]
$creadList :: ReadS [ApplicationComponentStrategy]
readsPrec :: Int -> ReadS ApplicationComponentStrategy
$creadsPrec :: Int -> ReadS ApplicationComponentStrategy
Prelude.Read, Int -> ApplicationComponentStrategy -> ShowS
[ApplicationComponentStrategy] -> ShowS
ApplicationComponentStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationComponentStrategy] -> ShowS
$cshowList :: [ApplicationComponentStrategy] -> ShowS
show :: ApplicationComponentStrategy -> String
$cshow :: ApplicationComponentStrategy -> String
showsPrec :: Int -> ApplicationComponentStrategy -> ShowS
$cshowsPrec :: Int -> ApplicationComponentStrategy -> ShowS
Prelude.Show, forall x.
Rep ApplicationComponentStrategy x -> ApplicationComponentStrategy
forall x.
ApplicationComponentStrategy -> Rep ApplicationComponentStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApplicationComponentStrategy x -> ApplicationComponentStrategy
$cfrom :: forall x.
ApplicationComponentStrategy -> Rep ApplicationComponentStrategy x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationComponentStrategy' 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:
--
-- 'isPreferred', 'applicationComponentStrategy_isPreferred' - Set to true if the recommendation is set as preferred.
--
-- 'recommendation', 'applicationComponentStrategy_recommendation' - Strategy recommendation for the application component.
--
-- 'status', 'applicationComponentStrategy_status' - The recommendation status of a strategy for an application component.
newApplicationComponentStrategy ::
  ApplicationComponentStrategy
newApplicationComponentStrategy :: ApplicationComponentStrategy
newApplicationComponentStrategy =
  ApplicationComponentStrategy'
    { $sel:isPreferred:ApplicationComponentStrategy' :: Maybe Bool
isPreferred =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recommendation:ApplicationComponentStrategy' :: Maybe RecommendationSet
recommendation = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ApplicationComponentStrategy' :: Maybe StrategyRecommendation
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Set to true if the recommendation is set as preferred.
applicationComponentStrategy_isPreferred :: Lens.Lens' ApplicationComponentStrategy (Prelude.Maybe Prelude.Bool)
applicationComponentStrategy_isPreferred :: Lens' ApplicationComponentStrategy (Maybe Bool)
applicationComponentStrategy_isPreferred = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponentStrategy' {Maybe Bool
isPreferred :: Maybe Bool
$sel:isPreferred:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe Bool
isPreferred} -> Maybe Bool
isPreferred) (\s :: ApplicationComponentStrategy
s@ApplicationComponentStrategy' {} Maybe Bool
a -> ApplicationComponentStrategy
s {$sel:isPreferred:ApplicationComponentStrategy' :: Maybe Bool
isPreferred = Maybe Bool
a} :: ApplicationComponentStrategy)

-- | Strategy recommendation for the application component.
applicationComponentStrategy_recommendation :: Lens.Lens' ApplicationComponentStrategy (Prelude.Maybe RecommendationSet)
applicationComponentStrategy_recommendation :: Lens' ApplicationComponentStrategy (Maybe RecommendationSet)
applicationComponentStrategy_recommendation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponentStrategy' {Maybe RecommendationSet
recommendation :: Maybe RecommendationSet
$sel:recommendation:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe RecommendationSet
recommendation} -> Maybe RecommendationSet
recommendation) (\s :: ApplicationComponentStrategy
s@ApplicationComponentStrategy' {} Maybe RecommendationSet
a -> ApplicationComponentStrategy
s {$sel:recommendation:ApplicationComponentStrategy' :: Maybe RecommendationSet
recommendation = Maybe RecommendationSet
a} :: ApplicationComponentStrategy)

-- | The recommendation status of a strategy for an application component.
applicationComponentStrategy_status :: Lens.Lens' ApplicationComponentStrategy (Prelude.Maybe StrategyRecommendation)
applicationComponentStrategy_status :: Lens' ApplicationComponentStrategy (Maybe StrategyRecommendation)
applicationComponentStrategy_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponentStrategy' {Maybe StrategyRecommendation
status :: Maybe StrategyRecommendation
$sel:status:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe StrategyRecommendation
status} -> Maybe StrategyRecommendation
status) (\s :: ApplicationComponentStrategy
s@ApplicationComponentStrategy' {} Maybe StrategyRecommendation
a -> ApplicationComponentStrategy
s {$sel:status:ApplicationComponentStrategy' :: Maybe StrategyRecommendation
status = Maybe StrategyRecommendation
a} :: ApplicationComponentStrategy)

instance Data.FromJSON ApplicationComponentStrategy where
  parseJSON :: Value -> Parser ApplicationComponentStrategy
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationComponentStrategy"
      ( \Object
x ->
          Maybe Bool
-> Maybe RecommendationSet
-> Maybe StrategyRecommendation
-> ApplicationComponentStrategy
ApplicationComponentStrategy'
            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
"isPreferred")
            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
"recommendation")
            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
    ApplicationComponentStrategy
  where
  hashWithSalt :: Int -> ApplicationComponentStrategy -> Int
hashWithSalt Int
_salt ApplicationComponentStrategy' {Maybe Bool
Maybe StrategyRecommendation
Maybe RecommendationSet
status :: Maybe StrategyRecommendation
recommendation :: Maybe RecommendationSet
isPreferred :: Maybe Bool
$sel:status:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe StrategyRecommendation
$sel:recommendation:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe RecommendationSet
$sel:isPreferred:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isPreferred
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RecommendationSet
recommendation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StrategyRecommendation
status

instance Prelude.NFData ApplicationComponentStrategy where
  rnf :: ApplicationComponentStrategy -> ()
rnf ApplicationComponentStrategy' {Maybe Bool
Maybe StrategyRecommendation
Maybe RecommendationSet
status :: Maybe StrategyRecommendation
recommendation :: Maybe RecommendationSet
isPreferred :: Maybe Bool
$sel:status:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe StrategyRecommendation
$sel:recommendation:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe RecommendationSet
$sel:isPreferred:ApplicationComponentStrategy' :: ApplicationComponentStrategy -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isPreferred
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RecommendationSet
recommendation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StrategyRecommendation
status