{-# 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.CodeGuruReviewer.Types.CodeReview
-- 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.CodeGuruReviewer.Types.CodeReview where

import Amazonka.CodeGuruReviewer.Types.AnalysisType
import Amazonka.CodeGuruReviewer.Types.JobState
import Amazonka.CodeGuruReviewer.Types.Metrics
import Amazonka.CodeGuruReviewer.Types.ProviderType
import Amazonka.CodeGuruReviewer.Types.SourceCodeType
import Amazonka.CodeGuruReviewer.Types.Type
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a code review. A code review belongs to the associated
-- repository that contains the reviewed code.
--
-- /See:/ 'newCodeReview' smart constructor.
data CodeReview = CodeReview'
  { -- | The Amazon Resource Name (ARN) of the
    -- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html RepositoryAssociation>
    -- that contains the reviewed source code. You can retrieve associated
    -- repository ARNs by calling
    -- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html ListRepositoryAssociations>
    -- .
    CodeReview -> Maybe Text
associationArn :: Prelude.Maybe Prelude.Text,
    -- | The valid code review states are:
    --
    -- -   @Completed@: The code review is complete.
    --
    -- -   @Pending@: The code review started and has not completed or failed.
    --
    -- -   @Failed@: The code review failed.
    --
    -- -   @Deleting@: The code review is being deleted.
    CodeReview -> Maybe JobState
state :: Prelude.Maybe JobState,
    -- | The statistics from the code review.
    CodeReview -> Maybe Metrics
metrics :: Prelude.Maybe Metrics,
    -- | The pull request ID for the code review.
    CodeReview -> Maybe Text
pullRequestId :: Prelude.Maybe Prelude.Text,
    -- | The type of repository that contains the reviewed code (for example,
    -- GitHub or Bitbucket).
    CodeReview -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    -- | The owner of the repository. For an Amazon Web Services CodeCommit
    -- repository, this is the Amazon Web Services account ID of the account
    -- that owns the repository. For a GitHub, GitHub Enterprise Server, or
    -- Bitbucket repository, this is the username for the account that owns the
    -- repository. For an S3 repository, it can be the username or Amazon Web
    -- Services account ID.
    CodeReview -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The name of the code review.
    CodeReview -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the
    -- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
    -- object.
    CodeReview -> Maybe Text
codeReviewArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the repository.
    CodeReview -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text,
    -- | The type of code review.
    CodeReview -> Maybe Type
type' :: Prelude.Maybe Type,
    -- | The type of the source code for the code review.
    CodeReview -> Maybe SourceCodeType
sourceCodeType :: Prelude.Maybe SourceCodeType,
    -- | The reason for the state of the code review.
    CodeReview -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the code review was
    -- created.
    CodeReview -> Maybe POSIX
createdTimeStamp :: Prelude.Maybe Core.POSIX,
    -- | They types of analysis performed during a repository analysis or a pull
    -- request review. You can specify either @Security@, @CodeQuality@, or
    -- both.
    CodeReview -> Maybe [AnalysisType]
analysisTypes :: Prelude.Maybe [AnalysisType],
    -- | The time, in milliseconds since the epoch, when the code review was last
    -- updated.
    CodeReview -> Maybe POSIX
lastUpdatedTimeStamp :: Prelude.Maybe Core.POSIX
  }
  deriving (CodeReview -> CodeReview -> Bool
(CodeReview -> CodeReview -> Bool)
-> (CodeReview -> CodeReview -> Bool) -> Eq CodeReview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeReview -> CodeReview -> Bool
$c/= :: CodeReview -> CodeReview -> Bool
== :: CodeReview -> CodeReview -> Bool
$c== :: CodeReview -> CodeReview -> Bool
Prelude.Eq, ReadPrec [CodeReview]
ReadPrec CodeReview
Int -> ReadS CodeReview
ReadS [CodeReview]
(Int -> ReadS CodeReview)
-> ReadS [CodeReview]
-> ReadPrec CodeReview
-> ReadPrec [CodeReview]
-> Read CodeReview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeReview]
$creadListPrec :: ReadPrec [CodeReview]
readPrec :: ReadPrec CodeReview
$creadPrec :: ReadPrec CodeReview
readList :: ReadS [CodeReview]
$creadList :: ReadS [CodeReview]
readsPrec :: Int -> ReadS CodeReview
$creadsPrec :: Int -> ReadS CodeReview
Prelude.Read, Int -> CodeReview -> ShowS
[CodeReview] -> ShowS
CodeReview -> String
(Int -> CodeReview -> ShowS)
-> (CodeReview -> String)
-> ([CodeReview] -> ShowS)
-> Show CodeReview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeReview] -> ShowS
$cshowList :: [CodeReview] -> ShowS
show :: CodeReview -> String
$cshow :: CodeReview -> String
showsPrec :: Int -> CodeReview -> ShowS
$cshowsPrec :: Int -> CodeReview -> ShowS
Prelude.Show, (forall x. CodeReview -> Rep CodeReview x)
-> (forall x. Rep CodeReview x -> CodeReview) -> Generic CodeReview
forall x. Rep CodeReview x -> CodeReview
forall x. CodeReview -> Rep CodeReview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeReview x -> CodeReview
$cfrom :: forall x. CodeReview -> Rep CodeReview x
Prelude.Generic)

-- |
-- Create a value of 'CodeReview' 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:
--
-- 'associationArn', 'codeReview_associationArn' - The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html RepositoryAssociation>
-- that contains the reviewed source code. You can retrieve associated
-- repository ARNs by calling
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html ListRepositoryAssociations>
-- .
--
-- 'state', 'codeReview_state' - The valid code review states are:
--
-- -   @Completed@: The code review is complete.
--
-- -   @Pending@: The code review started and has not completed or failed.
--
-- -   @Failed@: The code review failed.
--
-- -   @Deleting@: The code review is being deleted.
--
-- 'metrics', 'codeReview_metrics' - The statistics from the code review.
--
-- 'pullRequestId', 'codeReview_pullRequestId' - The pull request ID for the code review.
--
-- 'providerType', 'codeReview_providerType' - The type of repository that contains the reviewed code (for example,
-- GitHub or Bitbucket).
--
-- 'owner', 'codeReview_owner' - The owner of the repository. For an Amazon Web Services CodeCommit
-- repository, this is the Amazon Web Services account ID of the account
-- that owns the repository. For a GitHub, GitHub Enterprise Server, or
-- Bitbucket repository, this is the username for the account that owns the
-- repository. For an S3 repository, it can be the username or Amazon Web
-- Services account ID.
--
-- 'name', 'codeReview_name' - The name of the code review.
--
-- 'codeReviewArn', 'codeReview_codeReviewArn' - The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
-- object.
--
-- 'repositoryName', 'codeReview_repositoryName' - The name of the repository.
--
-- 'type'', 'codeReview_type' - The type of code review.
--
-- 'sourceCodeType', 'codeReview_sourceCodeType' - The type of the source code for the code review.
--
-- 'stateReason', 'codeReview_stateReason' - The reason for the state of the code review.
--
-- 'createdTimeStamp', 'codeReview_createdTimeStamp' - The time, in milliseconds since the epoch, when the code review was
-- created.
--
-- 'analysisTypes', 'codeReview_analysisTypes' - They types of analysis performed during a repository analysis or a pull
-- request review. You can specify either @Security@, @CodeQuality@, or
-- both.
--
-- 'lastUpdatedTimeStamp', 'codeReview_lastUpdatedTimeStamp' - The time, in milliseconds since the epoch, when the code review was last
-- updated.
newCodeReview ::
  CodeReview
newCodeReview :: CodeReview
newCodeReview =
  CodeReview' :: Maybe Text
-> Maybe JobState
-> Maybe Metrics
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Type
-> Maybe SourceCodeType
-> Maybe Text
-> Maybe POSIX
-> Maybe [AnalysisType]
-> Maybe POSIX
-> CodeReview
CodeReview'
    { $sel:associationArn:CodeReview' :: Maybe Text
associationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:CodeReview' :: Maybe JobState
state = Maybe JobState
forall a. Maybe a
Prelude.Nothing,
      $sel:metrics:CodeReview' :: Maybe Metrics
metrics = Maybe Metrics
forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestId:CodeReview' :: Maybe Text
pullRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:CodeReview' :: Maybe ProviderType
providerType = Maybe ProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:CodeReview' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CodeReview' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:codeReviewArn:CodeReview' :: Maybe Text
codeReviewArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:CodeReview' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CodeReview' :: Maybe Type
type' = Maybe Type
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceCodeType:CodeReview' :: Maybe SourceCodeType
sourceCodeType = Maybe SourceCodeType
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:CodeReview' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimeStamp:CodeReview' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:analysisTypes:CodeReview' :: Maybe [AnalysisType]
analysisTypes = Maybe [AnalysisType]
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimeStamp:CodeReview' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html RepositoryAssociation>
-- that contains the reviewed source code. You can retrieve associated
-- repository ARNs by calling
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html ListRepositoryAssociations>
-- .
codeReview_associationArn :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_associationArn :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_associationArn = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
associationArn :: Maybe Text
$sel:associationArn:CodeReview' :: CodeReview -> Maybe Text
associationArn} -> Maybe Text
associationArn) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:associationArn:CodeReview' :: Maybe Text
associationArn = Maybe Text
a} :: CodeReview)

-- | The valid code review states are:
--
-- -   @Completed@: The code review is complete.
--
-- -   @Pending@: The code review started and has not completed or failed.
--
-- -   @Failed@: The code review failed.
--
-- -   @Deleting@: The code review is being deleted.
codeReview_state :: Lens.Lens' CodeReview (Prelude.Maybe JobState)
codeReview_state :: (Maybe JobState -> f (Maybe JobState))
-> CodeReview -> f CodeReview
codeReview_state = (CodeReview -> Maybe JobState)
-> (CodeReview -> Maybe JobState -> CodeReview)
-> Lens CodeReview CodeReview (Maybe JobState) (Maybe JobState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe JobState
state :: Maybe JobState
$sel:state:CodeReview' :: CodeReview -> Maybe JobState
state} -> Maybe JobState
state) (\s :: CodeReview
s@CodeReview' {} Maybe JobState
a -> CodeReview
s {$sel:state:CodeReview' :: Maybe JobState
state = Maybe JobState
a} :: CodeReview)

-- | The statistics from the code review.
codeReview_metrics :: Lens.Lens' CodeReview (Prelude.Maybe Metrics)
codeReview_metrics :: (Maybe Metrics -> f (Maybe Metrics)) -> CodeReview -> f CodeReview
codeReview_metrics = (CodeReview -> Maybe Metrics)
-> (CodeReview -> Maybe Metrics -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Metrics) (Maybe Metrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Metrics
metrics :: Maybe Metrics
$sel:metrics:CodeReview' :: CodeReview -> Maybe Metrics
metrics} -> Maybe Metrics
metrics) (\s :: CodeReview
s@CodeReview' {} Maybe Metrics
a -> CodeReview
s {$sel:metrics:CodeReview' :: Maybe Metrics
metrics = Maybe Metrics
a} :: CodeReview)

-- | The pull request ID for the code review.
codeReview_pullRequestId :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_pullRequestId :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_pullRequestId = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
pullRequestId :: Maybe Text
$sel:pullRequestId:CodeReview' :: CodeReview -> Maybe Text
pullRequestId} -> Maybe Text
pullRequestId) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:pullRequestId:CodeReview' :: Maybe Text
pullRequestId = Maybe Text
a} :: CodeReview)

-- | The type of repository that contains the reviewed code (for example,
-- GitHub or Bitbucket).
codeReview_providerType :: Lens.Lens' CodeReview (Prelude.Maybe ProviderType)
codeReview_providerType :: (Maybe ProviderType -> f (Maybe ProviderType))
-> CodeReview -> f CodeReview
codeReview_providerType = (CodeReview -> Maybe ProviderType)
-> (CodeReview -> Maybe ProviderType -> CodeReview)
-> Lens
     CodeReview CodeReview (Maybe ProviderType) (Maybe ProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe ProviderType
providerType :: Maybe ProviderType
$sel:providerType:CodeReview' :: CodeReview -> Maybe ProviderType
providerType} -> Maybe ProviderType
providerType) (\s :: CodeReview
s@CodeReview' {} Maybe ProviderType
a -> CodeReview
s {$sel:providerType:CodeReview' :: Maybe ProviderType
providerType = Maybe ProviderType
a} :: CodeReview)

-- | The owner of the repository. For an Amazon Web Services CodeCommit
-- repository, this is the Amazon Web Services account ID of the account
-- that owns the repository. For a GitHub, GitHub Enterprise Server, or
-- Bitbucket repository, this is the username for the account that owns the
-- repository. For an S3 repository, it can be the username or Amazon Web
-- Services account ID.
codeReview_owner :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_owner :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_owner = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
owner :: Maybe Text
$sel:owner:CodeReview' :: CodeReview -> Maybe Text
owner} -> Maybe Text
owner) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:owner:CodeReview' :: Maybe Text
owner = Maybe Text
a} :: CodeReview)

-- | The name of the code review.
codeReview_name :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_name :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_name = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
name :: Maybe Text
$sel:name:CodeReview' :: CodeReview -> Maybe Text
name} -> Maybe Text
name) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:name:CodeReview' :: Maybe Text
name = Maybe Text
a} :: CodeReview)

-- | The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
-- object.
codeReview_codeReviewArn :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_codeReviewArn :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_codeReviewArn = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
codeReviewArn :: Maybe Text
$sel:codeReviewArn:CodeReview' :: CodeReview -> Maybe Text
codeReviewArn} -> Maybe Text
codeReviewArn) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:codeReviewArn:CodeReview' :: Maybe Text
codeReviewArn = Maybe Text
a} :: CodeReview)

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

-- | The type of code review.
codeReview_type :: Lens.Lens' CodeReview (Prelude.Maybe Type)
codeReview_type :: (Maybe Type -> f (Maybe Type)) -> CodeReview -> f CodeReview
codeReview_type = (CodeReview -> Maybe Type)
-> (CodeReview -> Maybe Type -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Type) (Maybe Type)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Type
type' :: Maybe Type
$sel:type':CodeReview' :: CodeReview -> Maybe Type
type'} -> Maybe Type
type') (\s :: CodeReview
s@CodeReview' {} Maybe Type
a -> CodeReview
s {$sel:type':CodeReview' :: Maybe Type
type' = Maybe Type
a} :: CodeReview)

-- | The type of the source code for the code review.
codeReview_sourceCodeType :: Lens.Lens' CodeReview (Prelude.Maybe SourceCodeType)
codeReview_sourceCodeType :: (Maybe SourceCodeType -> f (Maybe SourceCodeType))
-> CodeReview -> f CodeReview
codeReview_sourceCodeType = (CodeReview -> Maybe SourceCodeType)
-> (CodeReview -> Maybe SourceCodeType -> CodeReview)
-> Lens
     CodeReview CodeReview (Maybe SourceCodeType) (Maybe SourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe SourceCodeType
sourceCodeType :: Maybe SourceCodeType
$sel:sourceCodeType:CodeReview' :: CodeReview -> Maybe SourceCodeType
sourceCodeType} -> Maybe SourceCodeType
sourceCodeType) (\s :: CodeReview
s@CodeReview' {} Maybe SourceCodeType
a -> CodeReview
s {$sel:sourceCodeType:CodeReview' :: Maybe SourceCodeType
sourceCodeType = Maybe SourceCodeType
a} :: CodeReview)

-- | The reason for the state of the code review.
codeReview_stateReason :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.Text)
codeReview_stateReason :: (Maybe Text -> f (Maybe Text)) -> CodeReview -> f CodeReview
codeReview_stateReason = (CodeReview -> Maybe Text)
-> (CodeReview -> Maybe Text -> CodeReview)
-> Lens CodeReview CodeReview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:CodeReview' :: CodeReview -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: CodeReview
s@CodeReview' {} Maybe Text
a -> CodeReview
s {$sel:stateReason:CodeReview' :: Maybe Text
stateReason = Maybe Text
a} :: CodeReview)

-- | The time, in milliseconds since the epoch, when the code review was
-- created.
codeReview_createdTimeStamp :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.UTCTime)
codeReview_createdTimeStamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> CodeReview -> f CodeReview
codeReview_createdTimeStamp = (CodeReview -> Maybe POSIX)
-> (CodeReview -> Maybe POSIX -> CodeReview)
-> Lens CodeReview CodeReview (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe POSIX
createdTimeStamp :: Maybe POSIX
$sel:createdTimeStamp:CodeReview' :: CodeReview -> Maybe POSIX
createdTimeStamp} -> Maybe POSIX
createdTimeStamp) (\s :: CodeReview
s@CodeReview' {} Maybe POSIX
a -> CodeReview
s {$sel:createdTimeStamp:CodeReview' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
a} :: CodeReview) ((Maybe POSIX -> f (Maybe POSIX)) -> CodeReview -> f CodeReview)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CodeReview
-> f CodeReview
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

-- | They types of analysis performed during a repository analysis or a pull
-- request review. You can specify either @Security@, @CodeQuality@, or
-- both.
codeReview_analysisTypes :: Lens.Lens' CodeReview (Prelude.Maybe [AnalysisType])
codeReview_analysisTypes :: (Maybe [AnalysisType] -> f (Maybe [AnalysisType]))
-> CodeReview -> f CodeReview
codeReview_analysisTypes = (CodeReview -> Maybe [AnalysisType])
-> (CodeReview -> Maybe [AnalysisType] -> CodeReview)
-> Lens
     CodeReview CodeReview (Maybe [AnalysisType]) (Maybe [AnalysisType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe [AnalysisType]
analysisTypes :: Maybe [AnalysisType]
$sel:analysisTypes:CodeReview' :: CodeReview -> Maybe [AnalysisType]
analysisTypes} -> Maybe [AnalysisType]
analysisTypes) (\s :: CodeReview
s@CodeReview' {} Maybe [AnalysisType]
a -> CodeReview
s {$sel:analysisTypes:CodeReview' :: Maybe [AnalysisType]
analysisTypes = Maybe [AnalysisType]
a} :: CodeReview) ((Maybe [AnalysisType] -> f (Maybe [AnalysisType]))
 -> CodeReview -> f CodeReview)
-> ((Maybe [AnalysisType] -> f (Maybe [AnalysisType]))
    -> Maybe [AnalysisType] -> f (Maybe [AnalysisType]))
-> (Maybe [AnalysisType] -> f (Maybe [AnalysisType]))
-> CodeReview
-> f CodeReview
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AnalysisType] [AnalysisType] [AnalysisType] [AnalysisType]
-> Iso
     (Maybe [AnalysisType])
     (Maybe [AnalysisType])
     (Maybe [AnalysisType])
     (Maybe [AnalysisType])
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 [AnalysisType] [AnalysisType] [AnalysisType] [AnalysisType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time, in milliseconds since the epoch, when the code review was last
-- updated.
codeReview_lastUpdatedTimeStamp :: Lens.Lens' CodeReview (Prelude.Maybe Prelude.UTCTime)
codeReview_lastUpdatedTimeStamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> CodeReview -> f CodeReview
codeReview_lastUpdatedTimeStamp = (CodeReview -> Maybe POSIX)
-> (CodeReview -> Maybe POSIX -> CodeReview)
-> Lens CodeReview CodeReview (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeReview' {Maybe POSIX
lastUpdatedTimeStamp :: Maybe POSIX
$sel:lastUpdatedTimeStamp:CodeReview' :: CodeReview -> Maybe POSIX
lastUpdatedTimeStamp} -> Maybe POSIX
lastUpdatedTimeStamp) (\s :: CodeReview
s@CodeReview' {} Maybe POSIX
a -> CodeReview
s {$sel:lastUpdatedTimeStamp:CodeReview' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
a} :: CodeReview) ((Maybe POSIX -> f (Maybe POSIX)) -> CodeReview -> f CodeReview)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CodeReview
-> f CodeReview
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

instance Core.FromJSON CodeReview where
  parseJSON :: Value -> Parser CodeReview
parseJSON =
    String
-> (Object -> Parser CodeReview) -> Value -> Parser CodeReview
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CodeReview"
      ( \Object
x ->
          Maybe Text
-> Maybe JobState
-> Maybe Metrics
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Type
-> Maybe SourceCodeType
-> Maybe Text
-> Maybe POSIX
-> Maybe [AnalysisType]
-> Maybe POSIX
-> CodeReview
CodeReview'
            (Maybe Text
 -> Maybe JobState
 -> Maybe Metrics
 -> Maybe Text
 -> Maybe ProviderType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Type
 -> Maybe SourceCodeType
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe [AnalysisType]
 -> Maybe POSIX
 -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe JobState
      -> Maybe Metrics
      -> Maybe Text
      -> Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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
"AssociationArn")
            Parser
  (Maybe JobState
   -> Maybe Metrics
   -> Maybe Text
   -> Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe JobState)
-> Parser
     (Maybe Metrics
      -> Maybe Text
      -> Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe Metrics
   -> Maybe Text
   -> Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Metrics)
-> Parser
     (Maybe Text
      -> Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Metrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Metrics")
            Parser
  (Maybe Text
   -> Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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 ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe ProviderType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProviderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProviderType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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
"Owner")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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
"CodeReviewArn")
            Parser
  (Maybe Text
   -> Maybe Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Type
      -> Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
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 Type
   -> Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Type)
-> Parser
     (Maybe SourceCodeType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Type)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser
  (Maybe SourceCodeType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe SourceCodeType)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe [AnalysisType]
      -> Maybe POSIX
      -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SourceCodeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceCodeType")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe [AnalysisType]
   -> Maybe POSIX
   -> CodeReview)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe [AnalysisType] -> Maybe POSIX -> CodeReview)
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
"StateReason")
            Parser
  (Maybe POSIX -> Maybe [AnalysisType] -> Maybe POSIX -> CodeReview)
-> Parser (Maybe POSIX)
-> Parser (Maybe [AnalysisType] -> Maybe POSIX -> CodeReview)
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
"CreatedTimeStamp")
            Parser (Maybe [AnalysisType] -> Maybe POSIX -> CodeReview)
-> Parser (Maybe [AnalysisType])
-> Parser (Maybe POSIX -> CodeReview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AnalysisType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AnalysisTypes" Parser (Maybe (Maybe [AnalysisType]))
-> Maybe [AnalysisType] -> Parser (Maybe [AnalysisType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AnalysisType]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe POSIX -> CodeReview)
-> Parser (Maybe POSIX) -> Parser CodeReview
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
"LastUpdatedTimeStamp")
      )

instance Prelude.Hashable CodeReview

instance Prelude.NFData CodeReview