{-# 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.SSM.Types.DocumentReviewCommentSource
-- 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.SSM.Types.DocumentReviewCommentSource where

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
import Amazonka.SSM.Types.DocumentReviewCommentType

-- | Information about comments added to a document review request.
--
-- /See:/ 'newDocumentReviewCommentSource' smart constructor.
data DocumentReviewCommentSource = DocumentReviewCommentSource'
  { -- | The content of a comment entered by a user who requests a review of a
    -- new document version, or who reviews the new version.
    DocumentReviewCommentSource -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The type of information added to a review request. Currently, only the
    -- value @Comment@ is supported.
    DocumentReviewCommentSource -> Maybe DocumentReviewCommentType
type' :: Prelude.Maybe DocumentReviewCommentType
  }
  deriving (DocumentReviewCommentSource -> DocumentReviewCommentSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentReviewCommentSource -> DocumentReviewCommentSource -> Bool
$c/= :: DocumentReviewCommentSource -> DocumentReviewCommentSource -> Bool
== :: DocumentReviewCommentSource -> DocumentReviewCommentSource -> Bool
$c== :: DocumentReviewCommentSource -> DocumentReviewCommentSource -> Bool
Prelude.Eq, ReadPrec [DocumentReviewCommentSource]
ReadPrec DocumentReviewCommentSource
Int -> ReadS DocumentReviewCommentSource
ReadS [DocumentReviewCommentSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentReviewCommentSource]
$creadListPrec :: ReadPrec [DocumentReviewCommentSource]
readPrec :: ReadPrec DocumentReviewCommentSource
$creadPrec :: ReadPrec DocumentReviewCommentSource
readList :: ReadS [DocumentReviewCommentSource]
$creadList :: ReadS [DocumentReviewCommentSource]
readsPrec :: Int -> ReadS DocumentReviewCommentSource
$creadsPrec :: Int -> ReadS DocumentReviewCommentSource
Prelude.Read, Int -> DocumentReviewCommentSource -> ShowS
[DocumentReviewCommentSource] -> ShowS
DocumentReviewCommentSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentReviewCommentSource] -> ShowS
$cshowList :: [DocumentReviewCommentSource] -> ShowS
show :: DocumentReviewCommentSource -> String
$cshow :: DocumentReviewCommentSource -> String
showsPrec :: Int -> DocumentReviewCommentSource -> ShowS
$cshowsPrec :: Int -> DocumentReviewCommentSource -> ShowS
Prelude.Show, forall x.
Rep DocumentReviewCommentSource x -> DocumentReviewCommentSource
forall x.
DocumentReviewCommentSource -> Rep DocumentReviewCommentSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DocumentReviewCommentSource x -> DocumentReviewCommentSource
$cfrom :: forall x.
DocumentReviewCommentSource -> Rep DocumentReviewCommentSource x
Prelude.Generic)

-- |
-- Create a value of 'DocumentReviewCommentSource' 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:
--
-- 'content', 'documentReviewCommentSource_content' - The content of a comment entered by a user who requests a review of a
-- new document version, or who reviews the new version.
--
-- 'type'', 'documentReviewCommentSource_type' - The type of information added to a review request. Currently, only the
-- value @Comment@ is supported.
newDocumentReviewCommentSource ::
  DocumentReviewCommentSource
newDocumentReviewCommentSource :: DocumentReviewCommentSource
newDocumentReviewCommentSource =
  DocumentReviewCommentSource'
    { $sel:content:DocumentReviewCommentSource' :: Maybe Text
content =
        forall a. Maybe a
Prelude.Nothing,
      $sel:type':DocumentReviewCommentSource' :: Maybe DocumentReviewCommentType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The content of a comment entered by a user who requests a review of a
-- new document version, or who reviews the new version.
documentReviewCommentSource_content :: Lens.Lens' DocumentReviewCommentSource (Prelude.Maybe Prelude.Text)
documentReviewCommentSource_content :: Lens' DocumentReviewCommentSource (Maybe Text)
documentReviewCommentSource_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewCommentSource' {Maybe Text
content :: Maybe Text
$sel:content:DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe Text
content} -> Maybe Text
content) (\s :: DocumentReviewCommentSource
s@DocumentReviewCommentSource' {} Maybe Text
a -> DocumentReviewCommentSource
s {$sel:content:DocumentReviewCommentSource' :: Maybe Text
content = Maybe Text
a} :: DocumentReviewCommentSource)

-- | The type of information added to a review request. Currently, only the
-- value @Comment@ is supported.
documentReviewCommentSource_type :: Lens.Lens' DocumentReviewCommentSource (Prelude.Maybe DocumentReviewCommentType)
documentReviewCommentSource_type :: Lens' DocumentReviewCommentSource (Maybe DocumentReviewCommentType)
documentReviewCommentSource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewCommentSource' {Maybe DocumentReviewCommentType
type' :: Maybe DocumentReviewCommentType
$sel:type':DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe DocumentReviewCommentType
type'} -> Maybe DocumentReviewCommentType
type') (\s :: DocumentReviewCommentSource
s@DocumentReviewCommentSource' {} Maybe DocumentReviewCommentType
a -> DocumentReviewCommentSource
s {$sel:type':DocumentReviewCommentSource' :: Maybe DocumentReviewCommentType
type' = Maybe DocumentReviewCommentType
a} :: DocumentReviewCommentSource)

instance Data.FromJSON DocumentReviewCommentSource where
  parseJSON :: Value -> Parser DocumentReviewCommentSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DocumentReviewCommentSource"
      ( \Object
x ->
          Maybe Text
-> Maybe DocumentReviewCommentType -> DocumentReviewCommentSource
DocumentReviewCommentSource'
            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
"Content")
            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
"Type")
      )

instance Prelude.Hashable DocumentReviewCommentSource where
  hashWithSalt :: Int -> DocumentReviewCommentSource -> Int
hashWithSalt Int
_salt DocumentReviewCommentSource' {Maybe Text
Maybe DocumentReviewCommentType
type' :: Maybe DocumentReviewCommentType
content :: Maybe Text
$sel:type':DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe DocumentReviewCommentType
$sel:content:DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DocumentReviewCommentType
type'

instance Prelude.NFData DocumentReviewCommentSource where
  rnf :: DocumentReviewCommentSource -> ()
rnf DocumentReviewCommentSource' {Maybe Text
Maybe DocumentReviewCommentType
type' :: Maybe DocumentReviewCommentType
content :: Maybe Text
$sel:type':DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe DocumentReviewCommentType
$sel:content:DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentReviewCommentType
type'

instance Data.ToJSON DocumentReviewCommentSource where
  toJSON :: DocumentReviewCommentSource -> Value
toJSON DocumentReviewCommentSource' {Maybe Text
Maybe DocumentReviewCommentType
type' :: Maybe DocumentReviewCommentType
content :: Maybe Text
$sel:type':DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe DocumentReviewCommentType
$sel:content:DocumentReviewCommentSource' :: DocumentReviewCommentSource -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
content,
            (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DocumentReviewCommentType
type'
          ]
      )