{-# 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.Kafka.Types.StateInfo
-- 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.Kafka.Types.StateInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newStateInfo' smart constructor.
data StateInfo = StateInfo'
  { StateInfo -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    StateInfo -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (StateInfo -> StateInfo -> Bool
(StateInfo -> StateInfo -> Bool)
-> (StateInfo -> StateInfo -> Bool) -> Eq StateInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateInfo -> StateInfo -> Bool
$c/= :: StateInfo -> StateInfo -> Bool
== :: StateInfo -> StateInfo -> Bool
$c== :: StateInfo -> StateInfo -> Bool
Prelude.Eq, ReadPrec [StateInfo]
ReadPrec StateInfo
Int -> ReadS StateInfo
ReadS [StateInfo]
(Int -> ReadS StateInfo)
-> ReadS [StateInfo]
-> ReadPrec StateInfo
-> ReadPrec [StateInfo]
-> Read StateInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StateInfo]
$creadListPrec :: ReadPrec [StateInfo]
readPrec :: ReadPrec StateInfo
$creadPrec :: ReadPrec StateInfo
readList :: ReadS [StateInfo]
$creadList :: ReadS [StateInfo]
readsPrec :: Int -> ReadS StateInfo
$creadsPrec :: Int -> ReadS StateInfo
Prelude.Read, Int -> StateInfo -> ShowS
[StateInfo] -> ShowS
StateInfo -> String
(Int -> StateInfo -> ShowS)
-> (StateInfo -> String)
-> ([StateInfo] -> ShowS)
-> Show StateInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateInfo] -> ShowS
$cshowList :: [StateInfo] -> ShowS
show :: StateInfo -> String
$cshow :: StateInfo -> String
showsPrec :: Int -> StateInfo -> ShowS
$cshowsPrec :: Int -> StateInfo -> ShowS
Prelude.Show, (forall x. StateInfo -> Rep StateInfo x)
-> (forall x. Rep StateInfo x -> StateInfo) -> Generic StateInfo
forall x. Rep StateInfo x -> StateInfo
forall x. StateInfo -> Rep StateInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StateInfo x -> StateInfo
$cfrom :: forall x. StateInfo -> Rep StateInfo x
Prelude.Generic)

-- |
-- Create a value of 'StateInfo' 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', 'stateInfo_code' - Undocumented member.
--
-- 'message', 'stateInfo_message' - Undocumented member.
newStateInfo ::
  StateInfo
newStateInfo :: StateInfo
newStateInfo =
  StateInfo' :: Maybe Text -> Maybe Text -> StateInfo
StateInfo'
    { $sel:code:StateInfo' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:StateInfo' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
stateInfo_code :: Lens.Lens' StateInfo (Prelude.Maybe Prelude.Text)
stateInfo_code :: (Maybe Text -> f (Maybe Text)) -> StateInfo -> f StateInfo
stateInfo_code = (StateInfo -> Maybe Text)
-> (StateInfo -> Maybe Text -> StateInfo)
-> Lens StateInfo StateInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateInfo' {Maybe Text
code :: Maybe Text
$sel:code:StateInfo' :: StateInfo -> Maybe Text
code} -> Maybe Text
code) (\s :: StateInfo
s@StateInfo' {} Maybe Text
a -> StateInfo
s {$sel:code:StateInfo' :: Maybe Text
code = Maybe Text
a} :: StateInfo)

-- | Undocumented member.
stateInfo_message :: Lens.Lens' StateInfo (Prelude.Maybe Prelude.Text)
stateInfo_message :: (Maybe Text -> f (Maybe Text)) -> StateInfo -> f StateInfo
stateInfo_message = (StateInfo -> Maybe Text)
-> (StateInfo -> Maybe Text -> StateInfo)
-> Lens StateInfo StateInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateInfo' {Maybe Text
message :: Maybe Text
$sel:message:StateInfo' :: StateInfo -> Maybe Text
message} -> Maybe Text
message) (\s :: StateInfo
s@StateInfo' {} Maybe Text
a -> StateInfo
s {$sel:message:StateInfo' :: Maybe Text
message = Maybe Text
a} :: StateInfo)

instance Core.FromJSON StateInfo where
  parseJSON :: Value -> Parser StateInfo
parseJSON =
    String -> (Object -> Parser StateInfo) -> Value -> Parser StateInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StateInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> StateInfo
StateInfo'
            (Maybe Text -> Maybe Text -> StateInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> StateInfo)
forall (f :: * -> *) a b. Functor 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
"code")
            Parser (Maybe Text -> StateInfo)
-> Parser (Maybe Text) -> Parser StateInfo
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 StateInfo

instance Prelude.NFData StateInfo