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

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

-- | Returns information about a pull request.
--
-- /See:/ 'newPullRequest' smart constructor.
data PullRequest = PullRequest'
  { -- | The approval rules applied to the pull request.
    PullRequest -> Maybe [ApprovalRule]
approvalRules :: Prelude.Maybe [ApprovalRule],
    -- | The Amazon Resource Name (ARN) of the user who created the pull request.
    PullRequest -> Maybe Text
authorArn :: Prelude.Maybe Prelude.Text,
    -- | The system-generated ID of the pull request.
    PullRequest -> Maybe Text
pullRequestId :: Prelude.Maybe Prelude.Text,
    -- | The date and time the pull request was originally created, in timestamp
    -- format.
    PullRequest -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The status of the pull request. Pull request status can only change from
    -- @OPEN@ to @CLOSED@.
    PullRequest -> Maybe PullRequestStatusEnum
pullRequestStatus :: Prelude.Maybe PullRequestStatusEnum,
    -- | The user-defined title of the pull request. This title is displayed in
    -- the list of pull requests to other repository users.
    PullRequest -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | A unique, client-generated idempotency token that, when provided in a
    -- request, ensures the request cannot be repeated with a changed
    -- parameter. If a request is received with the same parameters and a token
    -- is included, the request returns information about the initial request
    -- that used that token.
    PullRequest -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The day and time of the last user or system activity on the pull
    -- request, in timestamp format.
    PullRequest -> Maybe POSIX
lastActivityDate :: Prelude.Maybe Core.POSIX,
    -- | The system-generated revision ID for the pull request.
    PullRequest -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | The targets of the pull request, including the source branch and
    -- destination branch for the pull request.
    PullRequest -> Maybe [PullRequestTarget]
pullRequestTargets :: Prelude.Maybe [PullRequestTarget],
    -- | The user-defined description of the pull request. This description can
    -- be used to clarify what should be reviewed and other details of the
    -- request.
    PullRequest -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (PullRequest -> PullRequest -> Bool
(PullRequest -> PullRequest -> Bool)
-> (PullRequest -> PullRequest -> Bool) -> Eq PullRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PullRequest -> PullRequest -> Bool
$c/= :: PullRequest -> PullRequest -> Bool
== :: PullRequest -> PullRequest -> Bool
$c== :: PullRequest -> PullRequest -> Bool
Prelude.Eq, ReadPrec [PullRequest]
ReadPrec PullRequest
Int -> ReadS PullRequest
ReadS [PullRequest]
(Int -> ReadS PullRequest)
-> ReadS [PullRequest]
-> ReadPrec PullRequest
-> ReadPrec [PullRequest]
-> Read PullRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PullRequest]
$creadListPrec :: ReadPrec [PullRequest]
readPrec :: ReadPrec PullRequest
$creadPrec :: ReadPrec PullRequest
readList :: ReadS [PullRequest]
$creadList :: ReadS [PullRequest]
readsPrec :: Int -> ReadS PullRequest
$creadsPrec :: Int -> ReadS PullRequest
Prelude.Read, Int -> PullRequest -> ShowS
[PullRequest] -> ShowS
PullRequest -> String
(Int -> PullRequest -> ShowS)
-> (PullRequest -> String)
-> ([PullRequest] -> ShowS)
-> Show PullRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PullRequest] -> ShowS
$cshowList :: [PullRequest] -> ShowS
show :: PullRequest -> String
$cshow :: PullRequest -> String
showsPrec :: Int -> PullRequest -> ShowS
$cshowsPrec :: Int -> PullRequest -> ShowS
Prelude.Show, (forall x. PullRequest -> Rep PullRequest x)
-> (forall x. Rep PullRequest x -> PullRequest)
-> Generic PullRequest
forall x. Rep PullRequest x -> PullRequest
forall x. PullRequest -> Rep PullRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PullRequest x -> PullRequest
$cfrom :: forall x. PullRequest -> Rep PullRequest x
Prelude.Generic)

-- |
-- Create a value of 'PullRequest' 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:
--
-- 'approvalRules', 'pullRequest_approvalRules' - The approval rules applied to the pull request.
--
-- 'authorArn', 'pullRequest_authorArn' - The Amazon Resource Name (ARN) of the user who created the pull request.
--
-- 'pullRequestId', 'pullRequest_pullRequestId' - The system-generated ID of the pull request.
--
-- 'creationDate', 'pullRequest_creationDate' - The date and time the pull request was originally created, in timestamp
-- format.
--
-- 'pullRequestStatus', 'pullRequest_pullRequestStatus' - The status of the pull request. Pull request status can only change from
-- @OPEN@ to @CLOSED@.
--
-- 'title', 'pullRequest_title' - The user-defined title of the pull request. This title is displayed in
-- the list of pull requests to other repository users.
--
-- 'clientRequestToken', 'pullRequest_clientRequestToken' - A unique, client-generated idempotency token that, when provided in a
-- request, ensures the request cannot be repeated with a changed
-- parameter. If a request is received with the same parameters and a token
-- is included, the request returns information about the initial request
-- that used that token.
--
-- 'lastActivityDate', 'pullRequest_lastActivityDate' - The day and time of the last user or system activity on the pull
-- request, in timestamp format.
--
-- 'revisionId', 'pullRequest_revisionId' - The system-generated revision ID for the pull request.
--
-- 'pullRequestTargets', 'pullRequest_pullRequestTargets' - The targets of the pull request, including the source branch and
-- destination branch for the pull request.
--
-- 'description', 'pullRequest_description' - The user-defined description of the pull request. This description can
-- be used to clarify what should be reviewed and other details of the
-- request.
newPullRequest ::
  PullRequest
newPullRequest :: PullRequest
newPullRequest =
  PullRequest' :: Maybe [ApprovalRule]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PullRequestStatusEnum
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe [PullRequestTarget]
-> Maybe Text
-> PullRequest
PullRequest'
    { $sel:approvalRules:PullRequest' :: Maybe [ApprovalRule]
approvalRules = Maybe [ApprovalRule]
forall a. Maybe a
Prelude.Nothing,
      $sel:authorArn:PullRequest' :: Maybe Text
authorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestId:PullRequest' :: Maybe Text
pullRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:PullRequest' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestStatus:PullRequest' :: Maybe PullRequestStatusEnum
pullRequestStatus = Maybe PullRequestStatusEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:title:PullRequest' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:PullRequest' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastActivityDate:PullRequest' :: Maybe POSIX
lastActivityDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:PullRequest' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestTargets:PullRequest' :: Maybe [PullRequestTarget]
pullRequestTargets = Maybe [PullRequestTarget]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PullRequest' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The approval rules applied to the pull request.
pullRequest_approvalRules :: Lens.Lens' PullRequest (Prelude.Maybe [ApprovalRule])
pullRequest_approvalRules :: (Maybe [ApprovalRule] -> f (Maybe [ApprovalRule]))
-> PullRequest -> f PullRequest
pullRequest_approvalRules = (PullRequest -> Maybe [ApprovalRule])
-> (PullRequest -> Maybe [ApprovalRule] -> PullRequest)
-> Lens
     PullRequest
     PullRequest
     (Maybe [ApprovalRule])
     (Maybe [ApprovalRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe [ApprovalRule]
approvalRules :: Maybe [ApprovalRule]
$sel:approvalRules:PullRequest' :: PullRequest -> Maybe [ApprovalRule]
approvalRules} -> Maybe [ApprovalRule]
approvalRules) (\s :: PullRequest
s@PullRequest' {} Maybe [ApprovalRule]
a -> PullRequest
s {$sel:approvalRules:PullRequest' :: Maybe [ApprovalRule]
approvalRules = Maybe [ApprovalRule]
a} :: PullRequest) ((Maybe [ApprovalRule] -> f (Maybe [ApprovalRule]))
 -> PullRequest -> f PullRequest)
-> ((Maybe [ApprovalRule] -> f (Maybe [ApprovalRule]))
    -> Maybe [ApprovalRule] -> f (Maybe [ApprovalRule]))
-> (Maybe [ApprovalRule] -> f (Maybe [ApprovalRule]))
-> PullRequest
-> f PullRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ApprovalRule] [ApprovalRule] [ApprovalRule] [ApprovalRule]
-> Iso
     (Maybe [ApprovalRule])
     (Maybe [ApprovalRule])
     (Maybe [ApprovalRule])
     (Maybe [ApprovalRule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [ApprovalRule] [ApprovalRule] [ApprovalRule] [ApprovalRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the user who created the pull request.
pullRequest_authorArn :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_authorArn :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_authorArn = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
authorArn :: Maybe Text
$sel:authorArn:PullRequest' :: PullRequest -> Maybe Text
authorArn} -> Maybe Text
authorArn) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:authorArn:PullRequest' :: Maybe Text
authorArn = Maybe Text
a} :: PullRequest)

-- | The system-generated ID of the pull request.
pullRequest_pullRequestId :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_pullRequestId :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_pullRequestId = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
pullRequestId :: Maybe Text
$sel:pullRequestId:PullRequest' :: PullRequest -> Maybe Text
pullRequestId} -> Maybe Text
pullRequestId) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:pullRequestId:PullRequest' :: Maybe Text
pullRequestId = Maybe Text
a} :: PullRequest)

-- | The date and time the pull request was originally created, in timestamp
-- format.
pullRequest_creationDate :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.UTCTime)
pullRequest_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PullRequest -> f PullRequest
pullRequest_creationDate = (PullRequest -> Maybe POSIX)
-> (PullRequest -> Maybe POSIX -> PullRequest)
-> Lens PullRequest PullRequest (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:PullRequest' :: PullRequest -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: PullRequest
s@PullRequest' {} Maybe POSIX
a -> PullRequest
s {$sel:creationDate:PullRequest' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: PullRequest) ((Maybe POSIX -> f (Maybe POSIX)) -> PullRequest -> f PullRequest)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PullRequest
-> f PullRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of the pull request. Pull request status can only change from
-- @OPEN@ to @CLOSED@.
pullRequest_pullRequestStatus :: Lens.Lens' PullRequest (Prelude.Maybe PullRequestStatusEnum)
pullRequest_pullRequestStatus :: (Maybe PullRequestStatusEnum -> f (Maybe PullRequestStatusEnum))
-> PullRequest -> f PullRequest
pullRequest_pullRequestStatus = (PullRequest -> Maybe PullRequestStatusEnum)
-> (PullRequest -> Maybe PullRequestStatusEnum -> PullRequest)
-> Lens
     PullRequest
     PullRequest
     (Maybe PullRequestStatusEnum)
     (Maybe PullRequestStatusEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe PullRequestStatusEnum
pullRequestStatus :: Maybe PullRequestStatusEnum
$sel:pullRequestStatus:PullRequest' :: PullRequest -> Maybe PullRequestStatusEnum
pullRequestStatus} -> Maybe PullRequestStatusEnum
pullRequestStatus) (\s :: PullRequest
s@PullRequest' {} Maybe PullRequestStatusEnum
a -> PullRequest
s {$sel:pullRequestStatus:PullRequest' :: Maybe PullRequestStatusEnum
pullRequestStatus = Maybe PullRequestStatusEnum
a} :: PullRequest)

-- | The user-defined title of the pull request. This title is displayed in
-- the list of pull requests to other repository users.
pullRequest_title :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_title :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_title = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
title :: Maybe Text
$sel:title:PullRequest' :: PullRequest -> Maybe Text
title} -> Maybe Text
title) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:title:PullRequest' :: Maybe Text
title = Maybe Text
a} :: PullRequest)

-- | A unique, client-generated idempotency token that, when provided in a
-- request, ensures the request cannot be repeated with a changed
-- parameter. If a request is received with the same parameters and a token
-- is included, the request returns information about the initial request
-- that used that token.
pullRequest_clientRequestToken :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_clientRequestToken :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_clientRequestToken = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:PullRequest' :: PullRequest -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:clientRequestToken:PullRequest' :: Maybe Text
clientRequestToken = Maybe Text
a} :: PullRequest)

-- | The day and time of the last user or system activity on the pull
-- request, in timestamp format.
pullRequest_lastActivityDate :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.UTCTime)
pullRequest_lastActivityDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PullRequest -> f PullRequest
pullRequest_lastActivityDate = (PullRequest -> Maybe POSIX)
-> (PullRequest -> Maybe POSIX -> PullRequest)
-> Lens PullRequest PullRequest (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe POSIX
lastActivityDate :: Maybe POSIX
$sel:lastActivityDate:PullRequest' :: PullRequest -> Maybe POSIX
lastActivityDate} -> Maybe POSIX
lastActivityDate) (\s :: PullRequest
s@PullRequest' {} Maybe POSIX
a -> PullRequest
s {$sel:lastActivityDate:PullRequest' :: Maybe POSIX
lastActivityDate = Maybe POSIX
a} :: PullRequest) ((Maybe POSIX -> f (Maybe POSIX)) -> PullRequest -> f PullRequest)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PullRequest
-> f PullRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The system-generated revision ID for the pull request.
pullRequest_revisionId :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_revisionId :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_revisionId = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:PullRequest' :: PullRequest -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:revisionId:PullRequest' :: Maybe Text
revisionId = Maybe Text
a} :: PullRequest)

-- | The targets of the pull request, including the source branch and
-- destination branch for the pull request.
pullRequest_pullRequestTargets :: Lens.Lens' PullRequest (Prelude.Maybe [PullRequestTarget])
pullRequest_pullRequestTargets :: (Maybe [PullRequestTarget] -> f (Maybe [PullRequestTarget]))
-> PullRequest -> f PullRequest
pullRequest_pullRequestTargets = (PullRequest -> Maybe [PullRequestTarget])
-> (PullRequest -> Maybe [PullRequestTarget] -> PullRequest)
-> Lens
     PullRequest
     PullRequest
     (Maybe [PullRequestTarget])
     (Maybe [PullRequestTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe [PullRequestTarget]
pullRequestTargets :: Maybe [PullRequestTarget]
$sel:pullRequestTargets:PullRequest' :: PullRequest -> Maybe [PullRequestTarget]
pullRequestTargets} -> Maybe [PullRequestTarget]
pullRequestTargets) (\s :: PullRequest
s@PullRequest' {} Maybe [PullRequestTarget]
a -> PullRequest
s {$sel:pullRequestTargets:PullRequest' :: Maybe [PullRequestTarget]
pullRequestTargets = Maybe [PullRequestTarget]
a} :: PullRequest) ((Maybe [PullRequestTarget] -> f (Maybe [PullRequestTarget]))
 -> PullRequest -> f PullRequest)
-> ((Maybe [PullRequestTarget] -> f (Maybe [PullRequestTarget]))
    -> Maybe [PullRequestTarget] -> f (Maybe [PullRequestTarget]))
-> (Maybe [PullRequestTarget] -> f (Maybe [PullRequestTarget]))
-> PullRequest
-> f PullRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PullRequestTarget]
  [PullRequestTarget]
  [PullRequestTarget]
  [PullRequestTarget]
-> Iso
     (Maybe [PullRequestTarget])
     (Maybe [PullRequestTarget])
     (Maybe [PullRequestTarget])
     (Maybe [PullRequestTarget])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [PullRequestTarget]
  [PullRequestTarget]
  [PullRequestTarget]
  [PullRequestTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user-defined description of the pull request. This description can
-- be used to clarify what should be reviewed and other details of the
-- request.
pullRequest_description :: Lens.Lens' PullRequest (Prelude.Maybe Prelude.Text)
pullRequest_description :: (Maybe Text -> f (Maybe Text)) -> PullRequest -> f PullRequest
pullRequest_description = (PullRequest -> Maybe Text)
-> (PullRequest -> Maybe Text -> PullRequest)
-> Lens PullRequest PullRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PullRequest' {Maybe Text
description :: Maybe Text
$sel:description:PullRequest' :: PullRequest -> Maybe Text
description} -> Maybe Text
description) (\s :: PullRequest
s@PullRequest' {} Maybe Text
a -> PullRequest
s {$sel:description:PullRequest' :: Maybe Text
description = Maybe Text
a} :: PullRequest)

instance Core.FromJSON PullRequest where
  parseJSON :: Value -> Parser PullRequest
parseJSON =
    String
-> (Object -> Parser PullRequest) -> Value -> Parser PullRequest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PullRequest"
      ( \Object
x ->
          Maybe [ApprovalRule]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PullRequestStatusEnum
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe [PullRequestTarget]
-> Maybe Text
-> PullRequest
PullRequest'
            (Maybe [ApprovalRule]
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe PullRequestStatusEnum
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe [PullRequestTarget]
 -> Maybe Text
 -> PullRequest)
-> Parser (Maybe [ApprovalRule])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PullRequestStatusEnum
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ApprovalRule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"approvalRules" Parser (Maybe (Maybe [ApprovalRule]))
-> Maybe [ApprovalRule] -> Parser (Maybe [ApprovalRule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ApprovalRule]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PullRequestStatusEnum
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe PullRequestStatusEnum
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
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
"authorArn")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe PullRequestStatusEnum
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe PullRequestStatusEnum
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
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
"pullRequestId")
            Parser
  (Maybe POSIX
   -> Maybe PullRequestStatusEnum
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PullRequestStatusEnum
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDate")
            Parser
  (Maybe PullRequestStatusEnum
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe PullRequestStatusEnum)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
forall (f :: * -> *) a b. Applicative f => 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")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
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
"title")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe [PullRequestTarget]
      -> Maybe Text
      -> PullRequest)
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
"clientRequestToken")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe [PullRequestTarget]
   -> Maybe Text
   -> PullRequest)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe [PullRequestTarget] -> Maybe Text -> PullRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastActivityDate")
            Parser
  (Maybe Text
   -> Maybe [PullRequestTarget] -> Maybe Text -> PullRequest)
-> Parser (Maybe Text)
-> Parser (Maybe [PullRequestTarget] -> Maybe Text -> PullRequest)
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
"revisionId")
            Parser (Maybe [PullRequestTarget] -> Maybe Text -> PullRequest)
-> Parser (Maybe [PullRequestTarget])
-> Parser (Maybe Text -> PullRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [PullRequestTarget]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pullRequestTargets"
                            Parser (Maybe (Maybe [PullRequestTarget]))
-> Maybe [PullRequestTarget] -> Parser (Maybe [PullRequestTarget])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PullRequestTarget]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> PullRequest)
-> Parser (Maybe Text) -> Parser PullRequest
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
"description")
      )

instance Prelude.Hashable PullRequest

instance Prelude.NFData PullRequest