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

import Amazonka.CodeCommit.Types.ReactionValueFormats
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

-- | Information about the reaction values provided by users on a comment.
--
-- /See:/ 'newReactionForComment' smart constructor.
data ReactionForComment = ReactionForComment'
  { -- | The reaction for a specified comment.
    ReactionForComment -> Maybe ReactionValueFormats
reaction :: Prelude.Maybe ReactionValueFormats,
    -- | The Amazon Resource Names (ARNs) of users who have provided reactions to
    -- the comment.
    ReactionForComment -> Maybe [Text]
reactionUsers :: Prelude.Maybe [Prelude.Text],
    -- | A numerical count of users who reacted with the specified emoji whose
    -- identities have been subsequently deleted from IAM. While these IAM
    -- users or roles no longer exist, the reactions might still appear in
    -- total reaction counts.
    ReactionForComment -> Maybe Int
reactionsFromDeletedUsersCount :: Prelude.Maybe Prelude.Int
  }
  deriving (ReactionForComment -> ReactionForComment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReactionForComment -> ReactionForComment -> Bool
$c/= :: ReactionForComment -> ReactionForComment -> Bool
== :: ReactionForComment -> ReactionForComment -> Bool
$c== :: ReactionForComment -> ReactionForComment -> Bool
Prelude.Eq, ReadPrec [ReactionForComment]
ReadPrec ReactionForComment
Int -> ReadS ReactionForComment
ReadS [ReactionForComment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReactionForComment]
$creadListPrec :: ReadPrec [ReactionForComment]
readPrec :: ReadPrec ReactionForComment
$creadPrec :: ReadPrec ReactionForComment
readList :: ReadS [ReactionForComment]
$creadList :: ReadS [ReactionForComment]
readsPrec :: Int -> ReadS ReactionForComment
$creadsPrec :: Int -> ReadS ReactionForComment
Prelude.Read, Int -> ReactionForComment -> ShowS
[ReactionForComment] -> ShowS
ReactionForComment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReactionForComment] -> ShowS
$cshowList :: [ReactionForComment] -> ShowS
show :: ReactionForComment -> String
$cshow :: ReactionForComment -> String
showsPrec :: Int -> ReactionForComment -> ShowS
$cshowsPrec :: Int -> ReactionForComment -> ShowS
Prelude.Show, forall x. Rep ReactionForComment x -> ReactionForComment
forall x. ReactionForComment -> Rep ReactionForComment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReactionForComment x -> ReactionForComment
$cfrom :: forall x. ReactionForComment -> Rep ReactionForComment x
Prelude.Generic)

-- |
-- Create a value of 'ReactionForComment' 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:
--
-- 'reaction', 'reactionForComment_reaction' - The reaction for a specified comment.
--
-- 'reactionUsers', 'reactionForComment_reactionUsers' - The Amazon Resource Names (ARNs) of users who have provided reactions to
-- the comment.
--
-- 'reactionsFromDeletedUsersCount', 'reactionForComment_reactionsFromDeletedUsersCount' - A numerical count of users who reacted with the specified emoji whose
-- identities have been subsequently deleted from IAM. While these IAM
-- users or roles no longer exist, the reactions might still appear in
-- total reaction counts.
newReactionForComment ::
  ReactionForComment
newReactionForComment :: ReactionForComment
newReactionForComment =
  ReactionForComment'
    { $sel:reaction:ReactionForComment' :: Maybe ReactionValueFormats
reaction = forall a. Maybe a
Prelude.Nothing,
      $sel:reactionUsers:ReactionForComment' :: Maybe [Text]
reactionUsers = forall a. Maybe a
Prelude.Nothing,
      $sel:reactionsFromDeletedUsersCount:ReactionForComment' :: Maybe Int
reactionsFromDeletedUsersCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The reaction for a specified comment.
reactionForComment_reaction :: Lens.Lens' ReactionForComment (Prelude.Maybe ReactionValueFormats)
reactionForComment_reaction :: Lens' ReactionForComment (Maybe ReactionValueFormats)
reactionForComment_reaction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReactionForComment' {Maybe ReactionValueFormats
reaction :: Maybe ReactionValueFormats
$sel:reaction:ReactionForComment' :: ReactionForComment -> Maybe ReactionValueFormats
reaction} -> Maybe ReactionValueFormats
reaction) (\s :: ReactionForComment
s@ReactionForComment' {} Maybe ReactionValueFormats
a -> ReactionForComment
s {$sel:reaction:ReactionForComment' :: Maybe ReactionValueFormats
reaction = Maybe ReactionValueFormats
a} :: ReactionForComment)

-- | The Amazon Resource Names (ARNs) of users who have provided reactions to
-- the comment.
reactionForComment_reactionUsers :: Lens.Lens' ReactionForComment (Prelude.Maybe [Prelude.Text])
reactionForComment_reactionUsers :: Lens' ReactionForComment (Maybe [Text])
reactionForComment_reactionUsers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReactionForComment' {Maybe [Text]
reactionUsers :: Maybe [Text]
$sel:reactionUsers:ReactionForComment' :: ReactionForComment -> Maybe [Text]
reactionUsers} -> Maybe [Text]
reactionUsers) (\s :: ReactionForComment
s@ReactionForComment' {} Maybe [Text]
a -> ReactionForComment
s {$sel:reactionUsers:ReactionForComment' :: Maybe [Text]
reactionUsers = Maybe [Text]
a} :: ReactionForComment) 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

-- | A numerical count of users who reacted with the specified emoji whose
-- identities have been subsequently deleted from IAM. While these IAM
-- users or roles no longer exist, the reactions might still appear in
-- total reaction counts.
reactionForComment_reactionsFromDeletedUsersCount :: Lens.Lens' ReactionForComment (Prelude.Maybe Prelude.Int)
reactionForComment_reactionsFromDeletedUsersCount :: Lens' ReactionForComment (Maybe Int)
reactionForComment_reactionsFromDeletedUsersCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReactionForComment' {Maybe Int
reactionsFromDeletedUsersCount :: Maybe Int
$sel:reactionsFromDeletedUsersCount:ReactionForComment' :: ReactionForComment -> Maybe Int
reactionsFromDeletedUsersCount} -> Maybe Int
reactionsFromDeletedUsersCount) (\s :: ReactionForComment
s@ReactionForComment' {} Maybe Int
a -> ReactionForComment
s {$sel:reactionsFromDeletedUsersCount:ReactionForComment' :: Maybe Int
reactionsFromDeletedUsersCount = Maybe Int
a} :: ReactionForComment)

instance Data.FromJSON ReactionForComment where
  parseJSON :: Value -> Parser ReactionForComment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReactionForComment"
      ( \Object
x ->
          Maybe ReactionValueFormats
-> Maybe [Text] -> Maybe Int -> ReactionForComment
ReactionForComment'
            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
"reaction")
            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
"reactionUsers" 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
"reactionsFromDeletedUsersCount")
      )

instance Prelude.Hashable ReactionForComment where
  hashWithSalt :: Int -> ReactionForComment -> Int
hashWithSalt Int
_salt ReactionForComment' {Maybe Int
Maybe [Text]
Maybe ReactionValueFormats
reactionsFromDeletedUsersCount :: Maybe Int
reactionUsers :: Maybe [Text]
reaction :: Maybe ReactionValueFormats
$sel:reactionsFromDeletedUsersCount:ReactionForComment' :: ReactionForComment -> Maybe Int
$sel:reactionUsers:ReactionForComment' :: ReactionForComment -> Maybe [Text]
$sel:reaction:ReactionForComment' :: ReactionForComment -> Maybe ReactionValueFormats
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReactionValueFormats
reaction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
reactionUsers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
reactionsFromDeletedUsersCount

instance Prelude.NFData ReactionForComment where
  rnf :: ReactionForComment -> ()
rnf ReactionForComment' {Maybe Int
Maybe [Text]
Maybe ReactionValueFormats
reactionsFromDeletedUsersCount :: Maybe Int
reactionUsers :: Maybe [Text]
reaction :: Maybe ReactionValueFormats
$sel:reactionsFromDeletedUsersCount:ReactionForComment' :: ReactionForComment -> Maybe Int
$sel:reactionUsers:ReactionForComment' :: ReactionForComment -> Maybe [Text]
$sel:reaction:ReactionForComment' :: ReactionForComment -> Maybe ReactionValueFormats
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReactionValueFormats
reaction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
reactionUsers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
reactionsFromDeletedUsersCount