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

import Amazonka.CodeCommit.Types.OverrideStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information about an override event for approval rules for a
-- pull request.
--
-- /See:/ 'newApprovalRuleOverriddenEventMetadata' smart constructor.
data ApprovalRuleOverriddenEventMetadata = ApprovalRuleOverriddenEventMetadata'
  { -- | The status of the override event.
    ApprovalRuleOverriddenEventMetadata -> Maybe OverrideStatus
overrideStatus :: Prelude.Maybe OverrideStatus,
    -- | The revision ID of the pull request when the override event occurred.
    ApprovalRuleOverriddenEventMetadata -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text
  }
  deriving (ApprovalRuleOverriddenEventMetadata
-> ApprovalRuleOverriddenEventMetadata -> Bool
(ApprovalRuleOverriddenEventMetadata
 -> ApprovalRuleOverriddenEventMetadata -> Bool)
-> (ApprovalRuleOverriddenEventMetadata
    -> ApprovalRuleOverriddenEventMetadata -> Bool)
-> Eq ApprovalRuleOverriddenEventMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApprovalRuleOverriddenEventMetadata
-> ApprovalRuleOverriddenEventMetadata -> Bool
$c/= :: ApprovalRuleOverriddenEventMetadata
-> ApprovalRuleOverriddenEventMetadata -> Bool
== :: ApprovalRuleOverriddenEventMetadata
-> ApprovalRuleOverriddenEventMetadata -> Bool
$c== :: ApprovalRuleOverriddenEventMetadata
-> ApprovalRuleOverriddenEventMetadata -> Bool
Prelude.Eq, ReadPrec [ApprovalRuleOverriddenEventMetadata]
ReadPrec ApprovalRuleOverriddenEventMetadata
Int -> ReadS ApprovalRuleOverriddenEventMetadata
ReadS [ApprovalRuleOverriddenEventMetadata]
(Int -> ReadS ApprovalRuleOverriddenEventMetadata)
-> ReadS [ApprovalRuleOverriddenEventMetadata]
-> ReadPrec ApprovalRuleOverriddenEventMetadata
-> ReadPrec [ApprovalRuleOverriddenEventMetadata]
-> Read ApprovalRuleOverriddenEventMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApprovalRuleOverriddenEventMetadata]
$creadListPrec :: ReadPrec [ApprovalRuleOverriddenEventMetadata]
readPrec :: ReadPrec ApprovalRuleOverriddenEventMetadata
$creadPrec :: ReadPrec ApprovalRuleOverriddenEventMetadata
readList :: ReadS [ApprovalRuleOverriddenEventMetadata]
$creadList :: ReadS [ApprovalRuleOverriddenEventMetadata]
readsPrec :: Int -> ReadS ApprovalRuleOverriddenEventMetadata
$creadsPrec :: Int -> ReadS ApprovalRuleOverriddenEventMetadata
Prelude.Read, Int -> ApprovalRuleOverriddenEventMetadata -> ShowS
[ApprovalRuleOverriddenEventMetadata] -> ShowS
ApprovalRuleOverriddenEventMetadata -> String
(Int -> ApprovalRuleOverriddenEventMetadata -> ShowS)
-> (ApprovalRuleOverriddenEventMetadata -> String)
-> ([ApprovalRuleOverriddenEventMetadata] -> ShowS)
-> Show ApprovalRuleOverriddenEventMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApprovalRuleOverriddenEventMetadata] -> ShowS
$cshowList :: [ApprovalRuleOverriddenEventMetadata] -> ShowS
show :: ApprovalRuleOverriddenEventMetadata -> String
$cshow :: ApprovalRuleOverriddenEventMetadata -> String
showsPrec :: Int -> ApprovalRuleOverriddenEventMetadata -> ShowS
$cshowsPrec :: Int -> ApprovalRuleOverriddenEventMetadata -> ShowS
Prelude.Show, (forall x.
 ApprovalRuleOverriddenEventMetadata
 -> Rep ApprovalRuleOverriddenEventMetadata x)
-> (forall x.
    Rep ApprovalRuleOverriddenEventMetadata x
    -> ApprovalRuleOverriddenEventMetadata)
-> Generic ApprovalRuleOverriddenEventMetadata
forall x.
Rep ApprovalRuleOverriddenEventMetadata x
-> ApprovalRuleOverriddenEventMetadata
forall x.
ApprovalRuleOverriddenEventMetadata
-> Rep ApprovalRuleOverriddenEventMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApprovalRuleOverriddenEventMetadata x
-> ApprovalRuleOverriddenEventMetadata
$cfrom :: forall x.
ApprovalRuleOverriddenEventMetadata
-> Rep ApprovalRuleOverriddenEventMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ApprovalRuleOverriddenEventMetadata' 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:
--
-- 'overrideStatus', 'approvalRuleOverriddenEventMetadata_overrideStatus' - The status of the override event.
--
-- 'revisionId', 'approvalRuleOverriddenEventMetadata_revisionId' - The revision ID of the pull request when the override event occurred.
newApprovalRuleOverriddenEventMetadata ::
  ApprovalRuleOverriddenEventMetadata
newApprovalRuleOverriddenEventMetadata :: ApprovalRuleOverriddenEventMetadata
newApprovalRuleOverriddenEventMetadata =
  ApprovalRuleOverriddenEventMetadata' :: Maybe OverrideStatus
-> Maybe Text -> ApprovalRuleOverriddenEventMetadata
ApprovalRuleOverriddenEventMetadata'
    { $sel:overrideStatus:ApprovalRuleOverriddenEventMetadata' :: Maybe OverrideStatus
overrideStatus =
        Maybe OverrideStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:ApprovalRuleOverriddenEventMetadata' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the override event.
approvalRuleOverriddenEventMetadata_overrideStatus :: Lens.Lens' ApprovalRuleOverriddenEventMetadata (Prelude.Maybe OverrideStatus)
approvalRuleOverriddenEventMetadata_overrideStatus :: (Maybe OverrideStatus -> f (Maybe OverrideStatus))
-> ApprovalRuleOverriddenEventMetadata
-> f ApprovalRuleOverriddenEventMetadata
approvalRuleOverriddenEventMetadata_overrideStatus = (ApprovalRuleOverriddenEventMetadata -> Maybe OverrideStatus)
-> (ApprovalRuleOverriddenEventMetadata
    -> Maybe OverrideStatus -> ApprovalRuleOverriddenEventMetadata)
-> Lens
     ApprovalRuleOverriddenEventMetadata
     ApprovalRuleOverriddenEventMetadata
     (Maybe OverrideStatus)
     (Maybe OverrideStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalRuleOverriddenEventMetadata' {Maybe OverrideStatus
overrideStatus :: Maybe OverrideStatus
$sel:overrideStatus:ApprovalRuleOverriddenEventMetadata' :: ApprovalRuleOverriddenEventMetadata -> Maybe OverrideStatus
overrideStatus} -> Maybe OverrideStatus
overrideStatus) (\s :: ApprovalRuleOverriddenEventMetadata
s@ApprovalRuleOverriddenEventMetadata' {} Maybe OverrideStatus
a -> ApprovalRuleOverriddenEventMetadata
s {$sel:overrideStatus:ApprovalRuleOverriddenEventMetadata' :: Maybe OverrideStatus
overrideStatus = Maybe OverrideStatus
a} :: ApprovalRuleOverriddenEventMetadata)

-- | The revision ID of the pull request when the override event occurred.
approvalRuleOverriddenEventMetadata_revisionId :: Lens.Lens' ApprovalRuleOverriddenEventMetadata (Prelude.Maybe Prelude.Text)
approvalRuleOverriddenEventMetadata_revisionId :: (Maybe Text -> f (Maybe Text))
-> ApprovalRuleOverriddenEventMetadata
-> f ApprovalRuleOverriddenEventMetadata
approvalRuleOverriddenEventMetadata_revisionId = (ApprovalRuleOverriddenEventMetadata -> Maybe Text)
-> (ApprovalRuleOverriddenEventMetadata
    -> Maybe Text -> ApprovalRuleOverriddenEventMetadata)
-> Lens
     ApprovalRuleOverriddenEventMetadata
     ApprovalRuleOverriddenEventMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalRuleOverriddenEventMetadata' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:ApprovalRuleOverriddenEventMetadata' :: ApprovalRuleOverriddenEventMetadata -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: ApprovalRuleOverriddenEventMetadata
s@ApprovalRuleOverriddenEventMetadata' {} Maybe Text
a -> ApprovalRuleOverriddenEventMetadata
s {$sel:revisionId:ApprovalRuleOverriddenEventMetadata' :: Maybe Text
revisionId = Maybe Text
a} :: ApprovalRuleOverriddenEventMetadata)

instance
  Core.FromJSON
    ApprovalRuleOverriddenEventMetadata
  where
  parseJSON :: Value -> Parser ApprovalRuleOverriddenEventMetadata
parseJSON =
    String
-> (Object -> Parser ApprovalRuleOverriddenEventMetadata)
-> Value
-> Parser ApprovalRuleOverriddenEventMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApprovalRuleOverriddenEventMetadata"
      ( \Object
x ->
          Maybe OverrideStatus
-> Maybe Text -> ApprovalRuleOverriddenEventMetadata
ApprovalRuleOverriddenEventMetadata'
            (Maybe OverrideStatus
 -> Maybe Text -> ApprovalRuleOverriddenEventMetadata)
-> Parser (Maybe OverrideStatus)
-> Parser (Maybe Text -> ApprovalRuleOverriddenEventMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OverrideStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"overrideStatus")
            Parser (Maybe Text -> ApprovalRuleOverriddenEventMetadata)
-> Parser (Maybe Text)
-> Parser ApprovalRuleOverriddenEventMetadata
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")
      )

instance
  Prelude.Hashable
    ApprovalRuleOverriddenEventMetadata

instance
  Prelude.NFData
    ApprovalRuleOverriddenEventMetadata