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

import Amazonka.CodeCommit.Types.Comment
import Amazonka.CodeCommit.Types.Location
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information about comments on the comparison between two
-- commits.
--
-- /See:/ 'newCommentsForComparedCommit' smart constructor.
data CommentsForComparedCommit = CommentsForComparedCommit'
  { -- | The full blob ID of the commit used to establish the before of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
beforeBlobId :: Prelude.Maybe Prelude.Text,
    -- | Location information about the comment on the comparison, including the
    -- file name, line number, and whether the version of the file where the
    -- comment was made is BEFORE or AFTER.
    CommentsForComparedCommit -> Maybe Location
location :: Prelude.Maybe Location,
    -- | The full commit ID of the commit used to establish the after of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
afterCommitId :: Prelude.Maybe Prelude.Text,
    -- | The full blob ID of the commit used to establish the after of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
afterBlobId :: Prelude.Maybe Prelude.Text,
    -- | The full commit ID of the commit used to establish the before of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
beforeCommitId :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository that contains the compared commits.
    CommentsForComparedCommit -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | An array of comment objects. Each comment object contains information
    -- about a comment on the comparison between commits.
    CommentsForComparedCommit -> Maybe [Comment]
comments :: Prelude.Maybe [Comment]
  }
  deriving (CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
(CommentsForComparedCommit -> CommentsForComparedCommit -> Bool)
-> (CommentsForComparedCommit -> CommentsForComparedCommit -> Bool)
-> Eq CommentsForComparedCommit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
$c/= :: CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
== :: CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
$c== :: CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
Prelude.Eq, ReadPrec [CommentsForComparedCommit]
ReadPrec CommentsForComparedCommit
Int -> ReadS CommentsForComparedCommit
ReadS [CommentsForComparedCommit]
(Int -> ReadS CommentsForComparedCommit)
-> ReadS [CommentsForComparedCommit]
-> ReadPrec CommentsForComparedCommit
-> ReadPrec [CommentsForComparedCommit]
-> Read CommentsForComparedCommit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommentsForComparedCommit]
$creadListPrec :: ReadPrec [CommentsForComparedCommit]
readPrec :: ReadPrec CommentsForComparedCommit
$creadPrec :: ReadPrec CommentsForComparedCommit
readList :: ReadS [CommentsForComparedCommit]
$creadList :: ReadS [CommentsForComparedCommit]
readsPrec :: Int -> ReadS CommentsForComparedCommit
$creadsPrec :: Int -> ReadS CommentsForComparedCommit
Prelude.Read, Int -> CommentsForComparedCommit -> ShowS
[CommentsForComparedCommit] -> ShowS
CommentsForComparedCommit -> String
(Int -> CommentsForComparedCommit -> ShowS)
-> (CommentsForComparedCommit -> String)
-> ([CommentsForComparedCommit] -> ShowS)
-> Show CommentsForComparedCommit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommentsForComparedCommit] -> ShowS
$cshowList :: [CommentsForComparedCommit] -> ShowS
show :: CommentsForComparedCommit -> String
$cshow :: CommentsForComparedCommit -> String
showsPrec :: Int -> CommentsForComparedCommit -> ShowS
$cshowsPrec :: Int -> CommentsForComparedCommit -> ShowS
Prelude.Show, (forall x.
 CommentsForComparedCommit -> Rep CommentsForComparedCommit x)
-> (forall x.
    Rep CommentsForComparedCommit x -> CommentsForComparedCommit)
-> Generic CommentsForComparedCommit
forall x.
Rep CommentsForComparedCommit x -> CommentsForComparedCommit
forall x.
CommentsForComparedCommit -> Rep CommentsForComparedCommit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CommentsForComparedCommit x -> CommentsForComparedCommit
$cfrom :: forall x.
CommentsForComparedCommit -> Rep CommentsForComparedCommit x
Prelude.Generic)

-- |
-- Create a value of 'CommentsForComparedCommit' 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:
--
-- 'beforeBlobId', 'commentsForComparedCommit_beforeBlobId' - The full blob ID of the commit used to establish the before of the
-- comparison.
--
-- 'location', 'commentsForComparedCommit_location' - Location information about the comment on the comparison, including the
-- file name, line number, and whether the version of the file where the
-- comment was made is BEFORE or AFTER.
--
-- 'afterCommitId', 'commentsForComparedCommit_afterCommitId' - The full commit ID of the commit used to establish the after of the
-- comparison.
--
-- 'afterBlobId', 'commentsForComparedCommit_afterBlobId' - The full blob ID of the commit used to establish the after of the
-- comparison.
--
-- 'beforeCommitId', 'commentsForComparedCommit_beforeCommitId' - The full commit ID of the commit used to establish the before of the
-- comparison.
--
-- 'repositoryName', 'commentsForComparedCommit_repositoryName' - The name of the repository that contains the compared commits.
--
-- 'comments', 'commentsForComparedCommit_comments' - An array of comment objects. Each comment object contains information
-- about a comment on the comparison between commits.
newCommentsForComparedCommit ::
  CommentsForComparedCommit
newCommentsForComparedCommit :: CommentsForComparedCommit
newCommentsForComparedCommit =
  CommentsForComparedCommit' :: Maybe Text
-> Maybe Location
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Comment]
-> CommentsForComparedCommit
CommentsForComparedCommit'
    { $sel:beforeBlobId:CommentsForComparedCommit' :: Maybe Text
beforeBlobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:location:CommentsForComparedCommit' :: Maybe Location
location = Maybe Location
forall a. Maybe a
Prelude.Nothing,
      $sel:afterCommitId:CommentsForComparedCommit' :: Maybe Text
afterCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:afterBlobId:CommentsForComparedCommit' :: Maybe Text
afterBlobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:beforeCommitId:CommentsForComparedCommit' :: Maybe Text
beforeCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:CommentsForComparedCommit' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:comments:CommentsForComparedCommit' :: Maybe [Comment]
comments = Maybe [Comment]
forall a. Maybe a
Prelude.Nothing
    }

-- | The full blob ID of the commit used to establish the before of the
-- comparison.
commentsForComparedCommit_beforeBlobId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_beforeBlobId :: (Maybe Text -> f (Maybe Text))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_beforeBlobId = (CommentsForComparedCommit -> Maybe Text)
-> (CommentsForComparedCommit
    -> Maybe Text -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Text
beforeBlobId :: Maybe Text
$sel:beforeBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
beforeBlobId} -> Maybe Text
beforeBlobId) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Text
a -> CommentsForComparedCommit
s {$sel:beforeBlobId:CommentsForComparedCommit' :: Maybe Text
beforeBlobId = Maybe Text
a} :: CommentsForComparedCommit)

-- | Location information about the comment on the comparison, including the
-- file name, line number, and whether the version of the file where the
-- comment was made is BEFORE or AFTER.
commentsForComparedCommit_location :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Location)
commentsForComparedCommit_location :: (Maybe Location -> f (Maybe Location))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_location = (CommentsForComparedCommit -> Maybe Location)
-> (CommentsForComparedCommit
    -> Maybe Location -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Location)
     (Maybe Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Location
location :: Maybe Location
$sel:location:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Location
location} -> Maybe Location
location) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Location
a -> CommentsForComparedCommit
s {$sel:location:CommentsForComparedCommit' :: Maybe Location
location = Maybe Location
a} :: CommentsForComparedCommit)

-- | The full commit ID of the commit used to establish the after of the
-- comparison.
commentsForComparedCommit_afterCommitId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_afterCommitId :: (Maybe Text -> f (Maybe Text))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_afterCommitId = (CommentsForComparedCommit -> Maybe Text)
-> (CommentsForComparedCommit
    -> Maybe Text -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Text
afterCommitId :: Maybe Text
$sel:afterCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
afterCommitId} -> Maybe Text
afterCommitId) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Text
a -> CommentsForComparedCommit
s {$sel:afterCommitId:CommentsForComparedCommit' :: Maybe Text
afterCommitId = Maybe Text
a} :: CommentsForComparedCommit)

-- | The full blob ID of the commit used to establish the after of the
-- comparison.
commentsForComparedCommit_afterBlobId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_afterBlobId :: (Maybe Text -> f (Maybe Text))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_afterBlobId = (CommentsForComparedCommit -> Maybe Text)
-> (CommentsForComparedCommit
    -> Maybe Text -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Text
afterBlobId :: Maybe Text
$sel:afterBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
afterBlobId} -> Maybe Text
afterBlobId) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Text
a -> CommentsForComparedCommit
s {$sel:afterBlobId:CommentsForComparedCommit' :: Maybe Text
afterBlobId = Maybe Text
a} :: CommentsForComparedCommit)

-- | The full commit ID of the commit used to establish the before of the
-- comparison.
commentsForComparedCommit_beforeCommitId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_beforeCommitId :: (Maybe Text -> f (Maybe Text))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_beforeCommitId = (CommentsForComparedCommit -> Maybe Text)
-> (CommentsForComparedCommit
    -> Maybe Text -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Text
beforeCommitId :: Maybe Text
$sel:beforeCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
beforeCommitId} -> Maybe Text
beforeCommitId) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Text
a -> CommentsForComparedCommit
s {$sel:beforeCommitId:CommentsForComparedCommit' :: Maybe Text
beforeCommitId = Maybe Text
a} :: CommentsForComparedCommit)

-- | The name of the repository that contains the compared commits.
commentsForComparedCommit_repositoryName :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_repositoryName :: (Maybe Text -> f (Maybe Text))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_repositoryName = (CommentsForComparedCommit -> Maybe Text)
-> (CommentsForComparedCommit
    -> Maybe Text -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe Text
a -> CommentsForComparedCommit
s {$sel:repositoryName:CommentsForComparedCommit' :: Maybe Text
repositoryName = Maybe Text
a} :: CommentsForComparedCommit)

-- | An array of comment objects. Each comment object contains information
-- about a comment on the comparison between commits.
commentsForComparedCommit_comments :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe [Comment])
commentsForComparedCommit_comments :: (Maybe [Comment] -> f (Maybe [Comment]))
-> CommentsForComparedCommit -> f CommentsForComparedCommit
commentsForComparedCommit_comments = (CommentsForComparedCommit -> Maybe [Comment])
-> (CommentsForComparedCommit
    -> Maybe [Comment] -> CommentsForComparedCommit)
-> Lens
     CommentsForComparedCommit
     CommentsForComparedCommit
     (Maybe [Comment])
     (Maybe [Comment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentsForComparedCommit' {Maybe [Comment]
comments :: Maybe [Comment]
$sel:comments:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe [Comment]
comments} -> Maybe [Comment]
comments) (\s :: CommentsForComparedCommit
s@CommentsForComparedCommit' {} Maybe [Comment]
a -> CommentsForComparedCommit
s {$sel:comments:CommentsForComparedCommit' :: Maybe [Comment]
comments = Maybe [Comment]
a} :: CommentsForComparedCommit) ((Maybe [Comment] -> f (Maybe [Comment]))
 -> CommentsForComparedCommit -> f CommentsForComparedCommit)
-> ((Maybe [Comment] -> f (Maybe [Comment]))
    -> Maybe [Comment] -> f (Maybe [Comment]))
-> (Maybe [Comment] -> f (Maybe [Comment]))
-> CommentsForComparedCommit
-> f CommentsForComparedCommit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Comment] [Comment] [Comment] [Comment]
-> Iso
     (Maybe [Comment])
     (Maybe [Comment])
     (Maybe [Comment])
     (Maybe [Comment])
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 [Comment] [Comment] [Comment] [Comment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CommentsForComparedCommit where
  parseJSON :: Value -> Parser CommentsForComparedCommit
parseJSON =
    String
-> (Object -> Parser CommentsForComparedCommit)
-> Value
-> Parser CommentsForComparedCommit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CommentsForComparedCommit"
      ( \Object
x ->
          Maybe Text
-> Maybe Location
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Comment]
-> CommentsForComparedCommit
CommentsForComparedCommit'
            (Maybe Text
 -> Maybe Location
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Comment]
 -> CommentsForComparedCommit)
-> Parser (Maybe Text)
-> Parser
     (Maybe Location
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Comment]
      -> CommentsForComparedCommit)
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
"beforeBlobId")
            Parser
  (Maybe Location
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Comment]
   -> CommentsForComparedCommit)
-> Parser (Maybe Location)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Comment]
      -> CommentsForComparedCommit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Location)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"location")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Comment]
   -> CommentsForComparedCommit)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Comment]
      -> CommentsForComparedCommit)
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
"afterCommitId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Comment]
   -> CommentsForComparedCommit)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe [Comment] -> CommentsForComparedCommit)
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
"afterBlobId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe [Comment] -> CommentsForComparedCommit)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe [Comment] -> CommentsForComparedCommit)
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 [Comment] -> CommentsForComparedCommit)
-> Parser (Maybe Text)
-> Parser (Maybe [Comment] -> CommentsForComparedCommit)
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")
            Parser (Maybe [Comment] -> CommentsForComparedCommit)
-> Parser (Maybe [Comment]) -> Parser CommentsForComparedCommit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Comment]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"comments" Parser (Maybe (Maybe [Comment]))
-> Maybe [Comment] -> Parser (Maybe [Comment])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Comment]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CommentsForComparedCommit

instance Prelude.NFData CommentsForComparedCommit