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

import Amazonka.CodeGuruReviewer.Types.RepositoryHeadSourceCodeType
import Amazonka.CodeGuruReviewer.Types.SourceCodeType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A code review type that analyzes all code under a specified branch in an
-- associated repository. The associated repository is specified using its
-- ARN when you call
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview CreateCodeReview>
-- .
--
-- /See:/ 'newRepositoryAnalysis' smart constructor.
data RepositoryAnalysis = RepositoryAnalysis'
  { -- | A
    -- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType SourceCodeType>
    -- that specifies the tip of a branch in an associated repository.
    RepositoryAnalysis -> Maybe RepositoryHeadSourceCodeType
repositoryHead :: Prelude.Maybe RepositoryHeadSourceCodeType,
    RepositoryAnalysis -> Maybe SourceCodeType
sourceCodeType :: Prelude.Maybe SourceCodeType
  }
  deriving (RepositoryAnalysis -> RepositoryAnalysis -> Bool
(RepositoryAnalysis -> RepositoryAnalysis -> Bool)
-> (RepositoryAnalysis -> RepositoryAnalysis -> Bool)
-> Eq RepositoryAnalysis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryAnalysis -> RepositoryAnalysis -> Bool
$c/= :: RepositoryAnalysis -> RepositoryAnalysis -> Bool
== :: RepositoryAnalysis -> RepositoryAnalysis -> Bool
$c== :: RepositoryAnalysis -> RepositoryAnalysis -> Bool
Prelude.Eq, ReadPrec [RepositoryAnalysis]
ReadPrec RepositoryAnalysis
Int -> ReadS RepositoryAnalysis
ReadS [RepositoryAnalysis]
(Int -> ReadS RepositoryAnalysis)
-> ReadS [RepositoryAnalysis]
-> ReadPrec RepositoryAnalysis
-> ReadPrec [RepositoryAnalysis]
-> Read RepositoryAnalysis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryAnalysis]
$creadListPrec :: ReadPrec [RepositoryAnalysis]
readPrec :: ReadPrec RepositoryAnalysis
$creadPrec :: ReadPrec RepositoryAnalysis
readList :: ReadS [RepositoryAnalysis]
$creadList :: ReadS [RepositoryAnalysis]
readsPrec :: Int -> ReadS RepositoryAnalysis
$creadsPrec :: Int -> ReadS RepositoryAnalysis
Prelude.Read, Int -> RepositoryAnalysis -> ShowS
[RepositoryAnalysis] -> ShowS
RepositoryAnalysis -> String
(Int -> RepositoryAnalysis -> ShowS)
-> (RepositoryAnalysis -> String)
-> ([RepositoryAnalysis] -> ShowS)
-> Show RepositoryAnalysis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryAnalysis] -> ShowS
$cshowList :: [RepositoryAnalysis] -> ShowS
show :: RepositoryAnalysis -> String
$cshow :: RepositoryAnalysis -> String
showsPrec :: Int -> RepositoryAnalysis -> ShowS
$cshowsPrec :: Int -> RepositoryAnalysis -> ShowS
Prelude.Show, (forall x. RepositoryAnalysis -> Rep RepositoryAnalysis x)
-> (forall x. Rep RepositoryAnalysis x -> RepositoryAnalysis)
-> Generic RepositoryAnalysis
forall x. Rep RepositoryAnalysis x -> RepositoryAnalysis
forall x. RepositoryAnalysis -> Rep RepositoryAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RepositoryAnalysis x -> RepositoryAnalysis
$cfrom :: forall x. RepositoryAnalysis -> Rep RepositoryAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryAnalysis' 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:
--
-- 'repositoryHead', 'repositoryAnalysis_repositoryHead' - A
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType SourceCodeType>
-- that specifies the tip of a branch in an associated repository.
--
-- 'sourceCodeType', 'repositoryAnalysis_sourceCodeType' - Undocumented member.
newRepositoryAnalysis ::
  RepositoryAnalysis
newRepositoryAnalysis :: RepositoryAnalysis
newRepositoryAnalysis =
  RepositoryAnalysis' :: Maybe RepositoryHeadSourceCodeType
-> Maybe SourceCodeType -> RepositoryAnalysis
RepositoryAnalysis'
    { $sel:repositoryHead:RepositoryAnalysis' :: Maybe RepositoryHeadSourceCodeType
repositoryHead =
        Maybe RepositoryHeadSourceCodeType
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceCodeType:RepositoryAnalysis' :: Maybe SourceCodeType
sourceCodeType = Maybe SourceCodeType
forall a. Maybe a
Prelude.Nothing
    }

-- | A
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType SourceCodeType>
-- that specifies the tip of a branch in an associated repository.
repositoryAnalysis_repositoryHead :: Lens.Lens' RepositoryAnalysis (Prelude.Maybe RepositoryHeadSourceCodeType)
repositoryAnalysis_repositoryHead :: (Maybe RepositoryHeadSourceCodeType
 -> f (Maybe RepositoryHeadSourceCodeType))
-> RepositoryAnalysis -> f RepositoryAnalysis
repositoryAnalysis_repositoryHead = (RepositoryAnalysis -> Maybe RepositoryHeadSourceCodeType)
-> (RepositoryAnalysis
    -> Maybe RepositoryHeadSourceCodeType -> RepositoryAnalysis)
-> Lens
     RepositoryAnalysis
     RepositoryAnalysis
     (Maybe RepositoryHeadSourceCodeType)
     (Maybe RepositoryHeadSourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAnalysis' {Maybe RepositoryHeadSourceCodeType
repositoryHead :: Maybe RepositoryHeadSourceCodeType
$sel:repositoryHead:RepositoryAnalysis' :: RepositoryAnalysis -> Maybe RepositoryHeadSourceCodeType
repositoryHead} -> Maybe RepositoryHeadSourceCodeType
repositoryHead) (\s :: RepositoryAnalysis
s@RepositoryAnalysis' {} Maybe RepositoryHeadSourceCodeType
a -> RepositoryAnalysis
s {$sel:repositoryHead:RepositoryAnalysis' :: Maybe RepositoryHeadSourceCodeType
repositoryHead = Maybe RepositoryHeadSourceCodeType
a} :: RepositoryAnalysis)

-- | Undocumented member.
repositoryAnalysis_sourceCodeType :: Lens.Lens' RepositoryAnalysis (Prelude.Maybe SourceCodeType)
repositoryAnalysis_sourceCodeType :: (Maybe SourceCodeType -> f (Maybe SourceCodeType))
-> RepositoryAnalysis -> f RepositoryAnalysis
repositoryAnalysis_sourceCodeType = (RepositoryAnalysis -> Maybe SourceCodeType)
-> (RepositoryAnalysis
    -> Maybe SourceCodeType -> RepositoryAnalysis)
-> Lens
     RepositoryAnalysis
     RepositoryAnalysis
     (Maybe SourceCodeType)
     (Maybe SourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryAnalysis' {Maybe SourceCodeType
sourceCodeType :: Maybe SourceCodeType
$sel:sourceCodeType:RepositoryAnalysis' :: RepositoryAnalysis -> Maybe SourceCodeType
sourceCodeType} -> Maybe SourceCodeType
sourceCodeType) (\s :: RepositoryAnalysis
s@RepositoryAnalysis' {} Maybe SourceCodeType
a -> RepositoryAnalysis
s {$sel:sourceCodeType:RepositoryAnalysis' :: Maybe SourceCodeType
sourceCodeType = Maybe SourceCodeType
a} :: RepositoryAnalysis)

instance Prelude.Hashable RepositoryAnalysis

instance Prelude.NFData RepositoryAnalysis

instance Core.ToJSON RepositoryAnalysis where
  toJSON :: RepositoryAnalysis -> Value
toJSON RepositoryAnalysis' {Maybe RepositoryHeadSourceCodeType
Maybe SourceCodeType
sourceCodeType :: Maybe SourceCodeType
repositoryHead :: Maybe RepositoryHeadSourceCodeType
$sel:sourceCodeType:RepositoryAnalysis' :: RepositoryAnalysis -> Maybe SourceCodeType
$sel:repositoryHead:RepositoryAnalysis' :: RepositoryAnalysis -> Maybe RepositoryHeadSourceCodeType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RepositoryHead" Text -> RepositoryHeadSourceCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RepositoryHeadSourceCodeType -> Pair)
-> Maybe RepositoryHeadSourceCodeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RepositoryHeadSourceCodeType
repositoryHead,
            (Text
"SourceCodeType" Text -> SourceCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SourceCodeType -> Pair) -> Maybe SourceCodeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SourceCodeType
sourceCodeType
          ]
      )