{-# 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 #-}
module Amazonka.CodeGuruReviewer.Types.EventInfo where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EventInfo = EventInfo'
{
EventInfo -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
EventInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (EventInfo -> EventInfo -> Bool
(EventInfo -> EventInfo -> Bool)
-> (EventInfo -> EventInfo -> Bool) -> Eq EventInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventInfo -> EventInfo -> Bool
$c/= :: EventInfo -> EventInfo -> Bool
== :: EventInfo -> EventInfo -> Bool
$c== :: EventInfo -> EventInfo -> Bool
Prelude.Eq, ReadPrec [EventInfo]
ReadPrec EventInfo
Int -> ReadS EventInfo
ReadS [EventInfo]
(Int -> ReadS EventInfo)
-> ReadS [EventInfo]
-> ReadPrec EventInfo
-> ReadPrec [EventInfo]
-> Read EventInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventInfo]
$creadListPrec :: ReadPrec [EventInfo]
readPrec :: ReadPrec EventInfo
$creadPrec :: ReadPrec EventInfo
readList :: ReadS [EventInfo]
$creadList :: ReadS [EventInfo]
readsPrec :: Int -> ReadS EventInfo
$creadsPrec :: Int -> ReadS EventInfo
Prelude.Read, Int -> EventInfo -> ShowS
[EventInfo] -> ShowS
EventInfo -> String
(Int -> EventInfo -> ShowS)
-> (EventInfo -> String)
-> ([EventInfo] -> ShowS)
-> Show EventInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventInfo] -> ShowS
$cshowList :: [EventInfo] -> ShowS
show :: EventInfo -> String
$cshow :: EventInfo -> String
showsPrec :: Int -> EventInfo -> ShowS
$cshowsPrec :: Int -> EventInfo -> ShowS
Prelude.Show, (forall x. EventInfo -> Rep EventInfo x)
-> (forall x. Rep EventInfo x -> EventInfo) -> Generic EventInfo
forall x. Rep EventInfo x -> EventInfo
forall x. EventInfo -> Rep EventInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventInfo x -> EventInfo
$cfrom :: forall x. EventInfo -> Rep EventInfo x
Prelude.Generic)
newEventInfo ::
EventInfo
newEventInfo :: EventInfo
newEventInfo =
EventInfo' :: Maybe Text -> Maybe Text -> EventInfo
EventInfo'
{ $sel:state:EventInfo' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:EventInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
eventInfo_state :: Lens.Lens' EventInfo (Prelude.Maybe Prelude.Text)
eventInfo_state :: (Maybe Text -> f (Maybe Text)) -> EventInfo -> f EventInfo
eventInfo_state = (EventInfo -> Maybe Text)
-> (EventInfo -> Maybe Text -> EventInfo)
-> Lens EventInfo EventInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfo' {Maybe Text
state :: Maybe Text
$sel:state:EventInfo' :: EventInfo -> Maybe Text
state} -> Maybe Text
state) (\s :: EventInfo
s@EventInfo' {} Maybe Text
a -> EventInfo
s {$sel:state:EventInfo' :: Maybe Text
state = Maybe Text
a} :: EventInfo)
eventInfo_name :: Lens.Lens' EventInfo (Prelude.Maybe Prelude.Text)
eventInfo_name :: (Maybe Text -> f (Maybe Text)) -> EventInfo -> f EventInfo
eventInfo_name = (EventInfo -> Maybe Text)
-> (EventInfo -> Maybe Text -> EventInfo)
-> Lens EventInfo EventInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfo' {Maybe Text
name :: Maybe Text
$sel:name:EventInfo' :: EventInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: EventInfo
s@EventInfo' {} Maybe Text
a -> EventInfo
s {$sel:name:EventInfo' :: Maybe Text
name = Maybe Text
a} :: EventInfo)
instance Core.FromJSON EventInfo where
parseJSON :: Value -> Parser EventInfo
parseJSON =
String -> (Object -> Parser EventInfo) -> Value -> Parser EventInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EventInfo"
( \Object
x ->
Maybe Text -> Maybe Text -> EventInfo
EventInfo'
(Maybe Text -> Maybe Text -> EventInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EventInfo)
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
"State") Parser (Maybe Text -> EventInfo)
-> Parser (Maybe Text) -> Parser EventInfo
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
"Name")
)
instance Prelude.Hashable EventInfo
instance Prelude.NFData EventInfo
instance Core.ToJSON EventInfo where
toJSON :: EventInfo -> Value
toJSON EventInfo' {Maybe Text
name :: Maybe Text
state :: Maybe Text
$sel:name:EventInfo' :: EventInfo -> Maybe Text
$sel:state:EventInfo' :: EventInfo -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"State" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
state,
(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
]
)