{-# 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.CodeCommit.Types.PullRequestStatusChangedEventMetadata
-- 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.CodeCommit.Types.PullRequestStatusChangedEventMetadata where

import Amazonka.CodeCommit.Types.PullRequestStatusEnum
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a change to the status of a pull request.
--
-- /See:/ 'newPullRequestStatusChangedEventMetadata' smart constructor.
data PullRequestStatusChangedEventMetadata = PullRequestStatusChangedEventMetadata'
  { -- | The changed status of the pull request.
    PullRequestStatusChangedEventMetadata
-> Maybe PullRequestStatusEnum
pullRequestStatus :: Prelude.Maybe PullRequestStatusEnum
  }
  deriving (PullRequestStatusChangedEventMetadata
-> PullRequestStatusChangedEventMetadata -> Bool
(PullRequestStatusChangedEventMetadata
 -> PullRequestStatusChangedEventMetadata -> Bool)
-> (PullRequestStatusChangedEventMetadata
    -> PullRequestStatusChangedEventMetadata -> Bool)
-> Eq PullRequestStatusChangedEventMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PullRequestStatusChangedEventMetadata
-> PullRequestStatusChangedEventMetadata -> Bool
$c/= :: PullRequestStatusChangedEventMetadata
-> PullRequestStatusChangedEventMetadata -> Bool
== :: PullRequestStatusChangedEventMetadata
-> PullRequestStatusChangedEventMetadata -> Bool
$c== :: PullRequestStatusChangedEventMetadata
-> PullRequestStatusChangedEventMetadata -> Bool
Prelude.Eq, ReadPrec [PullRequestStatusChangedEventMetadata]
ReadPrec PullRequestStatusChangedEventMetadata
Int -> ReadS PullRequestStatusChangedEventMetadata
ReadS [PullRequestStatusChangedEventMetadata]
(Int -> ReadS PullRequestStatusChangedEventMetadata)
-> ReadS [PullRequestStatusChangedEventMetadata]
-> ReadPrec PullRequestStatusChangedEventMetadata
-> ReadPrec [PullRequestStatusChangedEventMetadata]
-> Read PullRequestStatusChangedEventMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PullRequestStatusChangedEventMetadata]
$creadListPrec :: ReadPrec [PullRequestStatusChangedEventMetadata]
readPrec :: ReadPrec PullRequestStatusChangedEventMetadata
$creadPrec :: ReadPrec PullRequestStatusChangedEventMetadata
readList :: ReadS [PullRequestStatusChangedEventMetadata]
$creadList :: ReadS [PullRequestStatusChangedEventMetadata]
readsPrec :: Int -> ReadS PullRequestStatusChangedEventMetadata
$creadsPrec :: Int -> ReadS PullRequestStatusChangedEventMetadata
Prelude.Read, Int -> PullRequestStatusChangedEventMetadata -> ShowS
[PullRequestStatusChangedEventMetadata] -> ShowS
PullRequestStatusChangedEventMetadata -> String
(Int -> PullRequestStatusChangedEventMetadata -> ShowS)
-> (PullRequestStatusChangedEventMetadata -> String)
-> ([PullRequestStatusChangedEventMetadata] -> ShowS)
-> Show PullRequestStatusChangedEventMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PullRequestStatusChangedEventMetadata] -> ShowS
$cshowList :: [PullRequestStatusChangedEventMetadata] -> ShowS
show :: PullRequestStatusChangedEventMetadata -> String
$cshow :: PullRequestStatusChangedEventMetadata -> String
showsPrec :: Int -> PullRequestStatusChangedEventMetadata -> ShowS
$cshowsPrec :: Int -> PullRequestStatusChangedEventMetadata -> ShowS
Prelude.Show, (forall x.
 PullRequestStatusChangedEventMetadata
 -> Rep PullRequestStatusChangedEventMetadata x)
-> (forall x.
    Rep PullRequestStatusChangedEventMetadata x
    -> PullRequestStatusChangedEventMetadata)
-> Generic PullRequestStatusChangedEventMetadata
forall x.
Rep PullRequestStatusChangedEventMetadata x
-> PullRequestStatusChangedEventMetadata
forall x.
PullRequestStatusChangedEventMetadata
-> Rep PullRequestStatusChangedEventMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PullRequestStatusChangedEventMetadata x
-> PullRequestStatusChangedEventMetadata
$cfrom :: forall x.
PullRequestStatusChangedEventMetadata
-> Rep PullRequestStatusChangedEventMetadata x
Prelude.Generic)

-- |
-- Create a value of 'PullRequestStatusChangedEventMetadata' 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:
--
-- 'pullRequestStatus', 'pullRequestStatusChangedEventMetadata_pullRequestStatus' - The changed status of the pull request.
newPullRequestStatusChangedEventMetadata ::
  PullRequestStatusChangedEventMetadata
newPullRequestStatusChangedEventMetadata :: PullRequestStatusChangedEventMetadata
newPullRequestStatusChangedEventMetadata =
  PullRequestStatusChangedEventMetadata' :: Maybe PullRequestStatusEnum
-> PullRequestStatusChangedEventMetadata
PullRequestStatusChangedEventMetadata'
    { $sel:pullRequestStatus:PullRequestStatusChangedEventMetadata' :: Maybe PullRequestStatusEnum
pullRequestStatus =
        Maybe PullRequestStatusEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | The changed status of the pull request.
pullRequestStatusChangedEventMetadata_pullRequestStatus :: Lens.Lens' PullRequestStatusChangedEventMetadata (Prelude.Maybe PullRequestStatusEnum)
pullRequestStatusChangedEventMetadata_pullRequestStatus :: (Maybe PullRequestStatusEnum -> f (Maybe PullRequestStatusEnum))
-> PullRequestStatusChangedEventMetadata
-> f PullRequestStatusChangedEventMetadata
pullRequestStatusChangedEventMetadata_pullRequestStatus = (PullRequestStatusChangedEventMetadata
 -> Maybe PullRequestStatusEnum)
-> (PullRequestStatusChangedEventMetadata
    -> Maybe PullRequestStatusEnum
    -> PullRequestStatusChangedEventMetadata)
-> Lens
     PullRequestStatusChangedEventMetadata
     PullRequestStatusChangedEventMetadata
     (Maybe PullRequestStatusEnum)
     (Maybe PullRequestStatusEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequestStatusChangedEventMetadata' {Maybe PullRequestStatusEnum
pullRequestStatus :: Maybe PullRequestStatusEnum
$sel:pullRequestStatus:PullRequestStatusChangedEventMetadata' :: PullRequestStatusChangedEventMetadata
-> Maybe PullRequestStatusEnum
pullRequestStatus} -> Maybe PullRequestStatusEnum
pullRequestStatus) (\s :: PullRequestStatusChangedEventMetadata
s@PullRequestStatusChangedEventMetadata' {} Maybe PullRequestStatusEnum
a -> PullRequestStatusChangedEventMetadata
s {$sel:pullRequestStatus:PullRequestStatusChangedEventMetadata' :: Maybe PullRequestStatusEnum
pullRequestStatus = Maybe PullRequestStatusEnum
a} :: PullRequestStatusChangedEventMetadata)

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

instance
  Prelude.Hashable
    PullRequestStatusChangedEventMetadata

instance
  Prelude.NFData
    PullRequestStatusChangedEventMetadata