{-# 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.StrategySummary
-- 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.StrategySummary 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.Strategy
import qualified Amazonka.Prelude as Prelude

-- | Object containing the summary of the strategy recommendations.
--
-- /See:/ 'newStrategySummary' smart constructor.
data StrategySummary = StrategySummary'
  { -- | The count of recommendations per strategy.
    StrategySummary -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The name of recommended strategy.
    StrategySummary -> Maybe Strategy
strategy :: Prelude.Maybe Strategy
  }
  deriving (StrategySummary -> StrategySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StrategySummary -> StrategySummary -> Bool
$c/= :: StrategySummary -> StrategySummary -> Bool
== :: StrategySummary -> StrategySummary -> Bool
$c== :: StrategySummary -> StrategySummary -> Bool
Prelude.Eq, ReadPrec [StrategySummary]
ReadPrec StrategySummary
Int -> ReadS StrategySummary
ReadS [StrategySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StrategySummary]
$creadListPrec :: ReadPrec [StrategySummary]
readPrec :: ReadPrec StrategySummary
$creadPrec :: ReadPrec StrategySummary
readList :: ReadS [StrategySummary]
$creadList :: ReadS [StrategySummary]
readsPrec :: Int -> ReadS StrategySummary
$creadsPrec :: Int -> ReadS StrategySummary
Prelude.Read, Int -> StrategySummary -> ShowS
[StrategySummary] -> ShowS
StrategySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StrategySummary] -> ShowS
$cshowList :: [StrategySummary] -> ShowS
show :: StrategySummary -> String
$cshow :: StrategySummary -> String
showsPrec :: Int -> StrategySummary -> ShowS
$cshowsPrec :: Int -> StrategySummary -> ShowS
Prelude.Show, forall x. Rep StrategySummary x -> StrategySummary
forall x. StrategySummary -> Rep StrategySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StrategySummary x -> StrategySummary
$cfrom :: forall x. StrategySummary -> Rep StrategySummary x
Prelude.Generic)

-- |
-- Create a value of 'StrategySummary' 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:
--
-- 'count', 'strategySummary_count' - The count of recommendations per strategy.
--
-- 'strategy', 'strategySummary_strategy' - The name of recommended strategy.
newStrategySummary ::
  StrategySummary
newStrategySummary :: StrategySummary
newStrategySummary =
  StrategySummary'
    { $sel:count:StrategySummary' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:strategy:StrategySummary' :: Maybe Strategy
strategy = forall a. Maybe a
Prelude.Nothing
    }

-- | The count of recommendations per strategy.
strategySummary_count :: Lens.Lens' StrategySummary (Prelude.Maybe Prelude.Int)
strategySummary_count :: Lens' StrategySummary (Maybe Int)
strategySummary_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StrategySummary' {Maybe Int
count :: Maybe Int
$sel:count:StrategySummary' :: StrategySummary -> Maybe Int
count} -> Maybe Int
count) (\s :: StrategySummary
s@StrategySummary' {} Maybe Int
a -> StrategySummary
s {$sel:count:StrategySummary' :: Maybe Int
count = Maybe Int
a} :: StrategySummary)

-- | The name of recommended strategy.
strategySummary_strategy :: Lens.Lens' StrategySummary (Prelude.Maybe Strategy)
strategySummary_strategy :: Lens' StrategySummary (Maybe Strategy)
strategySummary_strategy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StrategySummary' {Maybe Strategy
strategy :: Maybe Strategy
$sel:strategy:StrategySummary' :: StrategySummary -> Maybe Strategy
strategy} -> Maybe Strategy
strategy) (\s :: StrategySummary
s@StrategySummary' {} Maybe Strategy
a -> StrategySummary
s {$sel:strategy:StrategySummary' :: Maybe Strategy
strategy = Maybe Strategy
a} :: StrategySummary)

instance Data.FromJSON StrategySummary where
  parseJSON :: Value -> Parser StrategySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StrategySummary"
      ( \Object
x ->
          Maybe Int -> Maybe Strategy -> StrategySummary
StrategySummary'
            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
"count")
            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
"strategy")
      )

instance Prelude.Hashable StrategySummary where
  hashWithSalt :: Int -> StrategySummary -> Int
hashWithSalt Int
_salt StrategySummary' {Maybe Int
Maybe Strategy
strategy :: Maybe Strategy
count :: Maybe Int
$sel:strategy:StrategySummary' :: StrategySummary -> Maybe Strategy
$sel:count:StrategySummary' :: StrategySummary -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Strategy
strategy

instance Prelude.NFData StrategySummary where
  rnf :: StrategySummary -> ()
rnf StrategySummary' {Maybe Int
Maybe Strategy
strategy :: Maybe Strategy
count :: Maybe Int
$sel:strategy:StrategySummary' :: StrategySummary -> Maybe Strategy
$sel:count:StrategySummary' :: StrategySummary -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Strategy
strategy