{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 after of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
afterBlobId :: Prelude.Maybe Prelude.Text,
    -- | 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 before of the
    -- comparison.
    CommentsForComparedCommit -> Maybe Text
beforeBlobId :: 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,
    -- | 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],
    -- | 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 name of the repository that contains the compared commits.
    CommentsForComparedCommit -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text
  }
  deriving (CommentsForComparedCommit -> CommentsForComparedCommit -> Bool
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]
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
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.
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:
--
-- 'afterBlobId', 'commentsForComparedCommit_afterBlobId' - The full blob ID of the commit used to establish the after of the
-- comparison.
--
-- 'afterCommitId', 'commentsForComparedCommit_afterCommitId' - The full commit ID of the commit used to establish the after of the
-- comparison.
--
-- 'beforeBlobId', 'commentsForComparedCommit_beforeBlobId' - The full blob ID of the commit used to establish the before of the
-- comparison.
--
-- 'beforeCommitId', 'commentsForComparedCommit_beforeCommitId' - The full commit ID of the commit used to establish the before of the
-- comparison.
--
-- 'comments', 'commentsForComparedCommit_comments' - An array of comment objects. Each comment object contains information
-- about a comment on the comparison between commits.
--
-- '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.
--
-- 'repositoryName', 'commentsForComparedCommit_repositoryName' - The name of the repository that contains the compared commits.
newCommentsForComparedCommit ::
  CommentsForComparedCommit
newCommentsForComparedCommit :: CommentsForComparedCommit
newCommentsForComparedCommit =
  CommentsForComparedCommit'
    { $sel:afterBlobId:CommentsForComparedCommit' :: Maybe Text
afterBlobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:afterCommitId:CommentsForComparedCommit' :: Maybe Text
afterCommitId = forall a. Maybe a
Prelude.Nothing,
      $sel:beforeBlobId:CommentsForComparedCommit' :: Maybe Text
beforeBlobId = forall a. Maybe a
Prelude.Nothing,
      $sel:beforeCommitId:CommentsForComparedCommit' :: Maybe Text
beforeCommitId = forall a. Maybe a
Prelude.Nothing,
      $sel:comments:CommentsForComparedCommit' :: Maybe [Comment]
comments = forall a. Maybe a
Prelude.Nothing,
      $sel:location:CommentsForComparedCommit' :: Maybe Location
location = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:CommentsForComparedCommit' :: Maybe Text
repositoryName = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' CommentsForComparedCommit (Maybe Text)
commentsForComparedCommit_afterBlobId = 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 after of the
-- comparison.
commentsForComparedCommit_afterCommitId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_afterCommitId :: Lens' CommentsForComparedCommit (Maybe Text)
commentsForComparedCommit_afterCommitId = 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 before of the
-- comparison.
commentsForComparedCommit_beforeBlobId :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_beforeBlobId :: Lens' CommentsForComparedCommit (Maybe Text)
commentsForComparedCommit_beforeBlobId = 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)

-- | 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 :: Lens' CommentsForComparedCommit (Maybe Text)
commentsForComparedCommit_beforeCommitId = 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)

-- | 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 :: Lens' CommentsForComparedCommit (Maybe [Comment])
commentsForComparedCommit_comments = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' CommentsForComparedCommit (Maybe Location)
commentsForComparedCommit_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 name of the repository that contains the compared commits.
commentsForComparedCommit_repositoryName :: Lens.Lens' CommentsForComparedCommit (Prelude.Maybe Prelude.Text)
commentsForComparedCommit_repositoryName :: Lens' CommentsForComparedCommit (Maybe Text)
commentsForComparedCommit_repositoryName = 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)

instance Data.FromJSON CommentsForComparedCommit where
  parseJSON :: Value -> Parser CommentsForComparedCommit
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CommentsForComparedCommit"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Comment]
-> Maybe Location
-> Maybe Text
-> CommentsForComparedCommit
CommentsForComparedCommit'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"afterBlobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"afterCommitId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"beforeBlobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"beforeCommitId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"comments" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"location")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"repositoryName")
      )

instance Prelude.Hashable CommentsForComparedCommit where
  hashWithSalt :: Int -> CommentsForComparedCommit -> Int
hashWithSalt Int
_salt CommentsForComparedCommit' {Maybe [Comment]
Maybe Text
Maybe Location
repositoryName :: Maybe Text
location :: Maybe Location
comments :: Maybe [Comment]
beforeCommitId :: Maybe Text
beforeBlobId :: Maybe Text
afterCommitId :: Maybe Text
afterBlobId :: Maybe Text
$sel:repositoryName:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:location:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Location
$sel:comments:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe [Comment]
$sel:beforeCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:beforeBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:afterCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:afterBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
afterBlobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
afterCommitId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
beforeBlobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
beforeCommitId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Comment]
comments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Location
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryName

instance Prelude.NFData CommentsForComparedCommit where
  rnf :: CommentsForComparedCommit -> ()
rnf CommentsForComparedCommit' {Maybe [Comment]
Maybe Text
Maybe Location
repositoryName :: Maybe Text
location :: Maybe Location
comments :: Maybe [Comment]
beforeCommitId :: Maybe Text
beforeBlobId :: Maybe Text
afterCommitId :: Maybe Text
afterBlobId :: Maybe Text
$sel:repositoryName:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:location:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Location
$sel:comments:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe [Comment]
$sel:beforeCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:beforeBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:afterCommitId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
$sel:afterBlobId:CommentsForComparedCommit' :: CommentsForComparedCommit -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
afterBlobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
afterCommitId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
beforeBlobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
beforeCommitId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Comment]
comments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Location
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryName