{-# 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.NetworkManager.Types.TransitGatewayRegistrationStateReason
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.NetworkManager.Types.TransitGatewayRegistrationStateReason where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types.TransitGatewayRegistrationState
import qualified Amazonka.Prelude as Prelude

-- | Describes the status of a transit gateway registration.
--
-- /See:/ 'newTransitGatewayRegistrationStateReason' smart constructor.
data TransitGatewayRegistrationStateReason = TransitGatewayRegistrationStateReason'
  { -- | The code for the state reason.
    TransitGatewayRegistrationStateReason
-> Maybe TransitGatewayRegistrationState
code :: Prelude.Maybe TransitGatewayRegistrationState,
    -- | The message for the state reason.
    TransitGatewayRegistrationStateReason -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (TransitGatewayRegistrationStateReason
-> TransitGatewayRegistrationStateReason -> Bool
(TransitGatewayRegistrationStateReason
 -> TransitGatewayRegistrationStateReason -> Bool)
-> (TransitGatewayRegistrationStateReason
    -> TransitGatewayRegistrationStateReason -> Bool)
-> Eq TransitGatewayRegistrationStateReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayRegistrationStateReason
-> TransitGatewayRegistrationStateReason -> Bool
$c/= :: TransitGatewayRegistrationStateReason
-> TransitGatewayRegistrationStateReason -> Bool
== :: TransitGatewayRegistrationStateReason
-> TransitGatewayRegistrationStateReason -> Bool
$c== :: TransitGatewayRegistrationStateReason
-> TransitGatewayRegistrationStateReason -> Bool
Prelude.Eq, ReadPrec [TransitGatewayRegistrationStateReason]
ReadPrec TransitGatewayRegistrationStateReason
Int -> ReadS TransitGatewayRegistrationStateReason
ReadS [TransitGatewayRegistrationStateReason]
(Int -> ReadS TransitGatewayRegistrationStateReason)
-> ReadS [TransitGatewayRegistrationStateReason]
-> ReadPrec TransitGatewayRegistrationStateReason
-> ReadPrec [TransitGatewayRegistrationStateReason]
-> Read TransitGatewayRegistrationStateReason
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayRegistrationStateReason]
$creadListPrec :: ReadPrec [TransitGatewayRegistrationStateReason]
readPrec :: ReadPrec TransitGatewayRegistrationStateReason
$creadPrec :: ReadPrec TransitGatewayRegistrationStateReason
readList :: ReadS [TransitGatewayRegistrationStateReason]
$creadList :: ReadS [TransitGatewayRegistrationStateReason]
readsPrec :: Int -> ReadS TransitGatewayRegistrationStateReason
$creadsPrec :: Int -> ReadS TransitGatewayRegistrationStateReason
Prelude.Read, Int -> TransitGatewayRegistrationStateReason -> ShowS
[TransitGatewayRegistrationStateReason] -> ShowS
TransitGatewayRegistrationStateReason -> String
(Int -> TransitGatewayRegistrationStateReason -> ShowS)
-> (TransitGatewayRegistrationStateReason -> String)
-> ([TransitGatewayRegistrationStateReason] -> ShowS)
-> Show TransitGatewayRegistrationStateReason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayRegistrationStateReason] -> ShowS
$cshowList :: [TransitGatewayRegistrationStateReason] -> ShowS
show :: TransitGatewayRegistrationStateReason -> String
$cshow :: TransitGatewayRegistrationStateReason -> String
showsPrec :: Int -> TransitGatewayRegistrationStateReason -> ShowS
$cshowsPrec :: Int -> TransitGatewayRegistrationStateReason -> ShowS
Prelude.Show, (forall x.
 TransitGatewayRegistrationStateReason
 -> Rep TransitGatewayRegistrationStateReason x)
-> (forall x.
    Rep TransitGatewayRegistrationStateReason x
    -> TransitGatewayRegistrationStateReason)
-> Generic TransitGatewayRegistrationStateReason
forall x.
Rep TransitGatewayRegistrationStateReason x
-> TransitGatewayRegistrationStateReason
forall x.
TransitGatewayRegistrationStateReason
-> Rep TransitGatewayRegistrationStateReason x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayRegistrationStateReason x
-> TransitGatewayRegistrationStateReason
$cfrom :: forall x.
TransitGatewayRegistrationStateReason
-> Rep TransitGatewayRegistrationStateReason x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayRegistrationStateReason' 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:
--
-- 'code', 'transitGatewayRegistrationStateReason_code' - The code for the state reason.
--
-- 'message', 'transitGatewayRegistrationStateReason_message' - The message for the state reason.
newTransitGatewayRegistrationStateReason ::
  TransitGatewayRegistrationStateReason
newTransitGatewayRegistrationStateReason :: TransitGatewayRegistrationStateReason
newTransitGatewayRegistrationStateReason =
  TransitGatewayRegistrationStateReason' :: Maybe TransitGatewayRegistrationState
-> Maybe Text -> TransitGatewayRegistrationStateReason
TransitGatewayRegistrationStateReason'
    { $sel:code:TransitGatewayRegistrationStateReason' :: Maybe TransitGatewayRegistrationState
code =
        Maybe TransitGatewayRegistrationState
forall a. Maybe a
Prelude.Nothing,
      $sel:message:TransitGatewayRegistrationStateReason' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The code for the state reason.
transitGatewayRegistrationStateReason_code :: Lens.Lens' TransitGatewayRegistrationStateReason (Prelude.Maybe TransitGatewayRegistrationState)
transitGatewayRegistrationStateReason_code :: (Maybe TransitGatewayRegistrationState
 -> f (Maybe TransitGatewayRegistrationState))
-> TransitGatewayRegistrationStateReason
-> f TransitGatewayRegistrationStateReason
transitGatewayRegistrationStateReason_code = (TransitGatewayRegistrationStateReason
 -> Maybe TransitGatewayRegistrationState)
-> (TransitGatewayRegistrationStateReason
    -> Maybe TransitGatewayRegistrationState
    -> TransitGatewayRegistrationStateReason)
-> Lens
     TransitGatewayRegistrationStateReason
     TransitGatewayRegistrationStateReason
     (Maybe TransitGatewayRegistrationState)
     (Maybe TransitGatewayRegistrationState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRegistrationStateReason' {Maybe TransitGatewayRegistrationState
code :: Maybe TransitGatewayRegistrationState
$sel:code:TransitGatewayRegistrationStateReason' :: TransitGatewayRegistrationStateReason
-> Maybe TransitGatewayRegistrationState
code} -> Maybe TransitGatewayRegistrationState
code) (\s :: TransitGatewayRegistrationStateReason
s@TransitGatewayRegistrationStateReason' {} Maybe TransitGatewayRegistrationState
a -> TransitGatewayRegistrationStateReason
s {$sel:code:TransitGatewayRegistrationStateReason' :: Maybe TransitGatewayRegistrationState
code = Maybe TransitGatewayRegistrationState
a} :: TransitGatewayRegistrationStateReason)

-- | The message for the state reason.
transitGatewayRegistrationStateReason_message :: Lens.Lens' TransitGatewayRegistrationStateReason (Prelude.Maybe Prelude.Text)
transitGatewayRegistrationStateReason_message :: (Maybe Text -> f (Maybe Text))
-> TransitGatewayRegistrationStateReason
-> f TransitGatewayRegistrationStateReason
transitGatewayRegistrationStateReason_message = (TransitGatewayRegistrationStateReason -> Maybe Text)
-> (TransitGatewayRegistrationStateReason
    -> Maybe Text -> TransitGatewayRegistrationStateReason)
-> Lens
     TransitGatewayRegistrationStateReason
     TransitGatewayRegistrationStateReason
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRegistrationStateReason' {Maybe Text
message :: Maybe Text
$sel:message:TransitGatewayRegistrationStateReason' :: TransitGatewayRegistrationStateReason -> Maybe Text
message} -> Maybe Text
message) (\s :: TransitGatewayRegistrationStateReason
s@TransitGatewayRegistrationStateReason' {} Maybe Text
a -> TransitGatewayRegistrationStateReason
s {$sel:message:TransitGatewayRegistrationStateReason' :: Maybe Text
message = Maybe Text
a} :: TransitGatewayRegistrationStateReason)

instance
  Core.FromJSON
    TransitGatewayRegistrationStateReason
  where
  parseJSON :: Value -> Parser TransitGatewayRegistrationStateReason
parseJSON =
    String
-> (Object -> Parser TransitGatewayRegistrationStateReason)
-> Value
-> Parser TransitGatewayRegistrationStateReason
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TransitGatewayRegistrationStateReason"
      ( \Object
x ->
          Maybe TransitGatewayRegistrationState
-> Maybe Text -> TransitGatewayRegistrationStateReason
TransitGatewayRegistrationStateReason'
            (Maybe TransitGatewayRegistrationState
 -> Maybe Text -> TransitGatewayRegistrationStateReason)
-> Parser (Maybe TransitGatewayRegistrationState)
-> Parser (Maybe Text -> TransitGatewayRegistrationStateReason)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TransitGatewayRegistrationState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Code")
            Parser (Maybe Text -> TransitGatewayRegistrationStateReason)
-> Parser (Maybe Text)
-> Parser TransitGatewayRegistrationStateReason
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Message")
      )

instance
  Prelude.Hashable
    TransitGatewayRegistrationStateReason

instance
  Prelude.NFData
    TransitGatewayRegistrationStateReason