{-# 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.PullRequestSourceReferenceUpdatedEventMetadata
-- 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.PullRequestSourceReferenceUpdatedEventMetadata where

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

-- | Information about an update to the source branch of a pull request.
--
-- /See:/ 'newPullRequestSourceReferenceUpdatedEventMetadata' smart constructor.
data PullRequestSourceReferenceUpdatedEventMetadata = PullRequestSourceReferenceUpdatedEventMetadata'
  { -- | The full commit ID of the commit in the source branch that was the tip
    -- of the branch at the time the pull request was updated.
    PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
afterCommitId :: Prelude.Maybe Prelude.Text,
    -- | The full commit ID of the commit in the destination branch that was the
    -- tip of the branch at the time the pull request was updated.
    PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
beforeCommitId :: Prelude.Maybe Prelude.Text,
    -- | The commit ID of the most recent commit that the source branch and the
    -- destination branch have in common.
    PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
mergeBase :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository where the pull request was updated.
    PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text
  }
  deriving (PullRequestSourceReferenceUpdatedEventMetadata
-> PullRequestSourceReferenceUpdatedEventMetadata -> Bool
(PullRequestSourceReferenceUpdatedEventMetadata
 -> PullRequestSourceReferenceUpdatedEventMetadata -> Bool)
-> (PullRequestSourceReferenceUpdatedEventMetadata
    -> PullRequestSourceReferenceUpdatedEventMetadata -> Bool)
-> Eq PullRequestSourceReferenceUpdatedEventMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PullRequestSourceReferenceUpdatedEventMetadata
-> PullRequestSourceReferenceUpdatedEventMetadata -> Bool
$c/= :: PullRequestSourceReferenceUpdatedEventMetadata
-> PullRequestSourceReferenceUpdatedEventMetadata -> Bool
== :: PullRequestSourceReferenceUpdatedEventMetadata
-> PullRequestSourceReferenceUpdatedEventMetadata -> Bool
$c== :: PullRequestSourceReferenceUpdatedEventMetadata
-> PullRequestSourceReferenceUpdatedEventMetadata -> Bool
Prelude.Eq, ReadPrec [PullRequestSourceReferenceUpdatedEventMetadata]
ReadPrec PullRequestSourceReferenceUpdatedEventMetadata
Int -> ReadS PullRequestSourceReferenceUpdatedEventMetadata
ReadS [PullRequestSourceReferenceUpdatedEventMetadata]
(Int -> ReadS PullRequestSourceReferenceUpdatedEventMetadata)
-> ReadS [PullRequestSourceReferenceUpdatedEventMetadata]
-> ReadPrec PullRequestSourceReferenceUpdatedEventMetadata
-> ReadPrec [PullRequestSourceReferenceUpdatedEventMetadata]
-> Read PullRequestSourceReferenceUpdatedEventMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PullRequestSourceReferenceUpdatedEventMetadata]
$creadListPrec :: ReadPrec [PullRequestSourceReferenceUpdatedEventMetadata]
readPrec :: ReadPrec PullRequestSourceReferenceUpdatedEventMetadata
$creadPrec :: ReadPrec PullRequestSourceReferenceUpdatedEventMetadata
readList :: ReadS [PullRequestSourceReferenceUpdatedEventMetadata]
$creadList :: ReadS [PullRequestSourceReferenceUpdatedEventMetadata]
readsPrec :: Int -> ReadS PullRequestSourceReferenceUpdatedEventMetadata
$creadsPrec :: Int -> ReadS PullRequestSourceReferenceUpdatedEventMetadata
Prelude.Read, Int -> PullRequestSourceReferenceUpdatedEventMetadata -> ShowS
[PullRequestSourceReferenceUpdatedEventMetadata] -> ShowS
PullRequestSourceReferenceUpdatedEventMetadata -> String
(Int -> PullRequestSourceReferenceUpdatedEventMetadata -> ShowS)
-> (PullRequestSourceReferenceUpdatedEventMetadata -> String)
-> ([PullRequestSourceReferenceUpdatedEventMetadata] -> ShowS)
-> Show PullRequestSourceReferenceUpdatedEventMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PullRequestSourceReferenceUpdatedEventMetadata] -> ShowS
$cshowList :: [PullRequestSourceReferenceUpdatedEventMetadata] -> ShowS
show :: PullRequestSourceReferenceUpdatedEventMetadata -> String
$cshow :: PullRequestSourceReferenceUpdatedEventMetadata -> String
showsPrec :: Int -> PullRequestSourceReferenceUpdatedEventMetadata -> ShowS
$cshowsPrec :: Int -> PullRequestSourceReferenceUpdatedEventMetadata -> ShowS
Prelude.Show, (forall x.
 PullRequestSourceReferenceUpdatedEventMetadata
 -> Rep PullRequestSourceReferenceUpdatedEventMetadata x)
-> (forall x.
    Rep PullRequestSourceReferenceUpdatedEventMetadata x
    -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Generic PullRequestSourceReferenceUpdatedEventMetadata
forall x.
Rep PullRequestSourceReferenceUpdatedEventMetadata x
-> PullRequestSourceReferenceUpdatedEventMetadata
forall x.
PullRequestSourceReferenceUpdatedEventMetadata
-> Rep PullRequestSourceReferenceUpdatedEventMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PullRequestSourceReferenceUpdatedEventMetadata x
-> PullRequestSourceReferenceUpdatedEventMetadata
$cfrom :: forall x.
PullRequestSourceReferenceUpdatedEventMetadata
-> Rep PullRequestSourceReferenceUpdatedEventMetadata x
Prelude.Generic)

-- |
-- Create a value of 'PullRequestSourceReferenceUpdatedEventMetadata' 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:
--
-- 'afterCommitId', 'pullRequestSourceReferenceUpdatedEventMetadata_afterCommitId' - The full commit ID of the commit in the source branch that was the tip
-- of the branch at the time the pull request was updated.
--
-- 'beforeCommitId', 'pullRequestSourceReferenceUpdatedEventMetadata_beforeCommitId' - The full commit ID of the commit in the destination branch that was the
-- tip of the branch at the time the pull request was updated.
--
-- 'mergeBase', 'pullRequestSourceReferenceUpdatedEventMetadata_mergeBase' - The commit ID of the most recent commit that the source branch and the
-- destination branch have in common.
--
-- 'repositoryName', 'pullRequestSourceReferenceUpdatedEventMetadata_repositoryName' - The name of the repository where the pull request was updated.
newPullRequestSourceReferenceUpdatedEventMetadata ::
  PullRequestSourceReferenceUpdatedEventMetadata
newPullRequestSourceReferenceUpdatedEventMetadata :: PullRequestSourceReferenceUpdatedEventMetadata
newPullRequestSourceReferenceUpdatedEventMetadata =
  PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PullRequestSourceReferenceUpdatedEventMetadata
PullRequestSourceReferenceUpdatedEventMetadata'
    { $sel:afterCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
afterCommitId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:beforeCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
beforeCommitId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mergeBase:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
mergeBase = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
repositoryName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The full commit ID of the commit in the source branch that was the tip
-- of the branch at the time the pull request was updated.
pullRequestSourceReferenceUpdatedEventMetadata_afterCommitId :: Lens.Lens' PullRequestSourceReferenceUpdatedEventMetadata (Prelude.Maybe Prelude.Text)
pullRequestSourceReferenceUpdatedEventMetadata_afterCommitId :: (Maybe Text -> f (Maybe Text))
-> PullRequestSourceReferenceUpdatedEventMetadata
-> f PullRequestSourceReferenceUpdatedEventMetadata
pullRequestSourceReferenceUpdatedEventMetadata_afterCommitId = (PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text)
-> (PullRequestSourceReferenceUpdatedEventMetadata
    -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Lens
     PullRequestSourceReferenceUpdatedEventMetadata
     PullRequestSourceReferenceUpdatedEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequestSourceReferenceUpdatedEventMetadata' {Maybe Text
afterCommitId :: Maybe Text
$sel:afterCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
afterCommitId} -> Maybe Text
afterCommitId) (\s :: PullRequestSourceReferenceUpdatedEventMetadata
s@PullRequestSourceReferenceUpdatedEventMetadata' {} Maybe Text
a -> PullRequestSourceReferenceUpdatedEventMetadata
s {$sel:afterCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
afterCommitId = Maybe Text
a} :: PullRequestSourceReferenceUpdatedEventMetadata)

-- | The full commit ID of the commit in the destination branch that was the
-- tip of the branch at the time the pull request was updated.
pullRequestSourceReferenceUpdatedEventMetadata_beforeCommitId :: Lens.Lens' PullRequestSourceReferenceUpdatedEventMetadata (Prelude.Maybe Prelude.Text)
pullRequestSourceReferenceUpdatedEventMetadata_beforeCommitId :: (Maybe Text -> f (Maybe Text))
-> PullRequestSourceReferenceUpdatedEventMetadata
-> f PullRequestSourceReferenceUpdatedEventMetadata
pullRequestSourceReferenceUpdatedEventMetadata_beforeCommitId = (PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text)
-> (PullRequestSourceReferenceUpdatedEventMetadata
    -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Lens
     PullRequestSourceReferenceUpdatedEventMetadata
     PullRequestSourceReferenceUpdatedEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequestSourceReferenceUpdatedEventMetadata' {Maybe Text
beforeCommitId :: Maybe Text
$sel:beforeCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
beforeCommitId} -> Maybe Text
beforeCommitId) (\s :: PullRequestSourceReferenceUpdatedEventMetadata
s@PullRequestSourceReferenceUpdatedEventMetadata' {} Maybe Text
a -> PullRequestSourceReferenceUpdatedEventMetadata
s {$sel:beforeCommitId:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
beforeCommitId = Maybe Text
a} :: PullRequestSourceReferenceUpdatedEventMetadata)

-- | The commit ID of the most recent commit that the source branch and the
-- destination branch have in common.
pullRequestSourceReferenceUpdatedEventMetadata_mergeBase :: Lens.Lens' PullRequestSourceReferenceUpdatedEventMetadata (Prelude.Maybe Prelude.Text)
pullRequestSourceReferenceUpdatedEventMetadata_mergeBase :: (Maybe Text -> f (Maybe Text))
-> PullRequestSourceReferenceUpdatedEventMetadata
-> f PullRequestSourceReferenceUpdatedEventMetadata
pullRequestSourceReferenceUpdatedEventMetadata_mergeBase = (PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text)
-> (PullRequestSourceReferenceUpdatedEventMetadata
    -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Lens
     PullRequestSourceReferenceUpdatedEventMetadata
     PullRequestSourceReferenceUpdatedEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequestSourceReferenceUpdatedEventMetadata' {Maybe Text
mergeBase :: Maybe Text
$sel:mergeBase:PullRequestSourceReferenceUpdatedEventMetadata' :: PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
mergeBase} -> Maybe Text
mergeBase) (\s :: PullRequestSourceReferenceUpdatedEventMetadata
s@PullRequestSourceReferenceUpdatedEventMetadata' {} Maybe Text
a -> PullRequestSourceReferenceUpdatedEventMetadata
s {$sel:mergeBase:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
mergeBase = Maybe Text
a} :: PullRequestSourceReferenceUpdatedEventMetadata)

-- | The name of the repository where the pull request was updated.
pullRequestSourceReferenceUpdatedEventMetadata_repositoryName :: Lens.Lens' PullRequestSourceReferenceUpdatedEventMetadata (Prelude.Maybe Prelude.Text)
pullRequestSourceReferenceUpdatedEventMetadata_repositoryName :: (Maybe Text -> f (Maybe Text))
-> PullRequestSourceReferenceUpdatedEventMetadata
-> f PullRequestSourceReferenceUpdatedEventMetadata
pullRequestSourceReferenceUpdatedEventMetadata_repositoryName = (PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text)
-> (PullRequestSourceReferenceUpdatedEventMetadata
    -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Lens
     PullRequestSourceReferenceUpdatedEventMetadata
     PullRequestSourceReferenceUpdatedEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequestSourceReferenceUpdatedEventMetadata' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:PullRequestSourceReferenceUpdatedEventMetadata' :: PullRequestSourceReferenceUpdatedEventMetadata -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: PullRequestSourceReferenceUpdatedEventMetadata
s@PullRequestSourceReferenceUpdatedEventMetadata' {} Maybe Text
a -> PullRequestSourceReferenceUpdatedEventMetadata
s {$sel:repositoryName:PullRequestSourceReferenceUpdatedEventMetadata' :: Maybe Text
repositoryName = Maybe Text
a} :: PullRequestSourceReferenceUpdatedEventMetadata)

instance
  Core.FromJSON
    PullRequestSourceReferenceUpdatedEventMetadata
  where
  parseJSON :: Value -> Parser PullRequestSourceReferenceUpdatedEventMetadata
parseJSON =
    String
-> (Object
    -> Parser PullRequestSourceReferenceUpdatedEventMetadata)
-> Value
-> Parser PullRequestSourceReferenceUpdatedEventMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PullRequestSourceReferenceUpdatedEventMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PullRequestSourceReferenceUpdatedEventMetadata
PullRequestSourceReferenceUpdatedEventMetadata'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PullRequestSourceReferenceUpdatedEventMetadata)
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
"afterCommitId")
              Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
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
"beforeCommitId")
              Parser
  (Maybe Text
   -> Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
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
"mergeBase")
              Parser
  (Maybe Text -> PullRequestSourceReferenceUpdatedEventMetadata)
-> Parser (Maybe Text)
-> Parser PullRequestSourceReferenceUpdatedEventMetadata
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
"repositoryName")
      )

instance
  Prelude.Hashable
    PullRequestSourceReferenceUpdatedEventMetadata

instance
  Prelude.NFData
    PullRequestSourceReferenceUpdatedEventMetadata