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

-- | Object containing the choice of application destination that you
-- specify.
--
-- /See:/ 'newNoManagementPreference' smart constructor.
data NoManagementPreference = NoManagementPreference'
  { -- | The choice of application destination that you specify.
    NoManagementPreference -> NonEmpty NoPreferenceTargetDestination
targetDestination :: Prelude.NonEmpty NoPreferenceTargetDestination
  }
  deriving (NoManagementPreference -> NoManagementPreference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NoManagementPreference -> NoManagementPreference -> Bool
$c/= :: NoManagementPreference -> NoManagementPreference -> Bool
== :: NoManagementPreference -> NoManagementPreference -> Bool
$c== :: NoManagementPreference -> NoManagementPreference -> Bool
Prelude.Eq, ReadPrec [NoManagementPreference]
ReadPrec NoManagementPreference
Int -> ReadS NoManagementPreference
ReadS [NoManagementPreference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NoManagementPreference]
$creadListPrec :: ReadPrec [NoManagementPreference]
readPrec :: ReadPrec NoManagementPreference
$creadPrec :: ReadPrec NoManagementPreference
readList :: ReadS [NoManagementPreference]
$creadList :: ReadS [NoManagementPreference]
readsPrec :: Int -> ReadS NoManagementPreference
$creadsPrec :: Int -> ReadS NoManagementPreference
Prelude.Read, Int -> NoManagementPreference -> ShowS
[NoManagementPreference] -> ShowS
NoManagementPreference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NoManagementPreference] -> ShowS
$cshowList :: [NoManagementPreference] -> ShowS
show :: NoManagementPreference -> String
$cshow :: NoManagementPreference -> String
showsPrec :: Int -> NoManagementPreference -> ShowS
$cshowsPrec :: Int -> NoManagementPreference -> ShowS
Prelude.Show, forall x. Rep NoManagementPreference x -> NoManagementPreference
forall x. NoManagementPreference -> Rep NoManagementPreference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NoManagementPreference x -> NoManagementPreference
$cfrom :: forall x. NoManagementPreference -> Rep NoManagementPreference x
Prelude.Generic)

-- |
-- Create a value of 'NoManagementPreference' 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:
--
-- 'targetDestination', 'noManagementPreference_targetDestination' - The choice of application destination that you specify.
newNoManagementPreference ::
  -- | 'targetDestination'
  Prelude.NonEmpty NoPreferenceTargetDestination ->
  NoManagementPreference
newNoManagementPreference :: NonEmpty NoPreferenceTargetDestination -> NoManagementPreference
newNoManagementPreference NonEmpty NoPreferenceTargetDestination
pTargetDestination_ =
  NoManagementPreference'
    { $sel:targetDestination:NoManagementPreference' :: NonEmpty NoPreferenceTargetDestination
targetDestination =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty NoPreferenceTargetDestination
pTargetDestination_
    }

-- | The choice of application destination that you specify.
noManagementPreference_targetDestination :: Lens.Lens' NoManagementPreference (Prelude.NonEmpty NoPreferenceTargetDestination)
noManagementPreference_targetDestination :: Lens'
  NoManagementPreference (NonEmpty NoPreferenceTargetDestination)
noManagementPreference_targetDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoManagementPreference' {NonEmpty NoPreferenceTargetDestination
targetDestination :: NonEmpty NoPreferenceTargetDestination
$sel:targetDestination:NoManagementPreference' :: NoManagementPreference -> NonEmpty NoPreferenceTargetDestination
targetDestination} -> NonEmpty NoPreferenceTargetDestination
targetDestination) (\s :: NoManagementPreference
s@NoManagementPreference' {} NonEmpty NoPreferenceTargetDestination
a -> NoManagementPreference
s {$sel:targetDestination:NoManagementPreference' :: NonEmpty NoPreferenceTargetDestination
targetDestination = NonEmpty NoPreferenceTargetDestination
a} :: NoManagementPreference) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON NoManagementPreference where
  parseJSON :: Value -> Parser NoManagementPreference
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NoManagementPreference"
      ( \Object
x ->
          NonEmpty NoPreferenceTargetDestination -> NoManagementPreference
NoManagementPreference'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"targetDestination")
      )

instance Prelude.Hashable NoManagementPreference where
  hashWithSalt :: Int -> NoManagementPreference -> Int
hashWithSalt Int
_salt NoManagementPreference' {NonEmpty NoPreferenceTargetDestination
targetDestination :: NonEmpty NoPreferenceTargetDestination
$sel:targetDestination:NoManagementPreference' :: NoManagementPreference -> NonEmpty NoPreferenceTargetDestination
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty NoPreferenceTargetDestination
targetDestination

instance Prelude.NFData NoManagementPreference where
  rnf :: NoManagementPreference -> ()
rnf NoManagementPreference' {NonEmpty NoPreferenceTargetDestination
targetDestination :: NonEmpty NoPreferenceTargetDestination
$sel:targetDestination:NoManagementPreference' :: NoManagementPreference -> NonEmpty NoPreferenceTargetDestination
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty NoPreferenceTargetDestination
targetDestination

instance Data.ToJSON NoManagementPreference where
  toJSON :: NoManagementPreference -> Value
toJSON NoManagementPreference' {NonEmpty NoPreferenceTargetDestination
targetDestination :: NonEmpty NoPreferenceTargetDestination
$sel:targetDestination:NoManagementPreference' :: NoManagementPreference -> NonEmpty NoPreferenceTargetDestination
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"targetDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty NoPreferenceTargetDestination
targetDestination)
          ]
      )