{-# 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.ConnectCases.Types.CaseEventIncludedData
-- 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.ConnectCases.Types.CaseEventIncludedData where

import Amazonka.ConnectCases.Types.FieldIdentifier
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

-- | Details of what case data is published through the case event stream.
--
-- /See:/ 'newCaseEventIncludedData' smart constructor.
data CaseEventIncludedData = CaseEventIncludedData'
  { -- | List of field identifiers.
    CaseEventIncludedData -> [FieldIdentifier]
fields :: [FieldIdentifier]
  }
  deriving (CaseEventIncludedData -> CaseEventIncludedData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaseEventIncludedData -> CaseEventIncludedData -> Bool
$c/= :: CaseEventIncludedData -> CaseEventIncludedData -> Bool
== :: CaseEventIncludedData -> CaseEventIncludedData -> Bool
$c== :: CaseEventIncludedData -> CaseEventIncludedData -> Bool
Prelude.Eq, ReadPrec [CaseEventIncludedData]
ReadPrec CaseEventIncludedData
Int -> ReadS CaseEventIncludedData
ReadS [CaseEventIncludedData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaseEventIncludedData]
$creadListPrec :: ReadPrec [CaseEventIncludedData]
readPrec :: ReadPrec CaseEventIncludedData
$creadPrec :: ReadPrec CaseEventIncludedData
readList :: ReadS [CaseEventIncludedData]
$creadList :: ReadS [CaseEventIncludedData]
readsPrec :: Int -> ReadS CaseEventIncludedData
$creadsPrec :: Int -> ReadS CaseEventIncludedData
Prelude.Read, Int -> CaseEventIncludedData -> ShowS
[CaseEventIncludedData] -> ShowS
CaseEventIncludedData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaseEventIncludedData] -> ShowS
$cshowList :: [CaseEventIncludedData] -> ShowS
show :: CaseEventIncludedData -> String
$cshow :: CaseEventIncludedData -> String
showsPrec :: Int -> CaseEventIncludedData -> ShowS
$cshowsPrec :: Int -> CaseEventIncludedData -> ShowS
Prelude.Show, forall x. Rep CaseEventIncludedData x -> CaseEventIncludedData
forall x. CaseEventIncludedData -> Rep CaseEventIncludedData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaseEventIncludedData x -> CaseEventIncludedData
$cfrom :: forall x. CaseEventIncludedData -> Rep CaseEventIncludedData x
Prelude.Generic)

-- |
-- Create a value of 'CaseEventIncludedData' 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:
--
-- 'fields', 'caseEventIncludedData_fields' - List of field identifiers.
newCaseEventIncludedData ::
  CaseEventIncludedData
newCaseEventIncludedData :: CaseEventIncludedData
newCaseEventIncludedData =
  CaseEventIncludedData' {$sel:fields:CaseEventIncludedData' :: [FieldIdentifier]
fields = forall a. Monoid a => a
Prelude.mempty}

-- | List of field identifiers.
caseEventIncludedData_fields :: Lens.Lens' CaseEventIncludedData [FieldIdentifier]
caseEventIncludedData_fields :: Lens' CaseEventIncludedData [FieldIdentifier]
caseEventIncludedData_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaseEventIncludedData' {[FieldIdentifier]
fields :: [FieldIdentifier]
$sel:fields:CaseEventIncludedData' :: CaseEventIncludedData -> [FieldIdentifier]
fields} -> [FieldIdentifier]
fields) (\s :: CaseEventIncludedData
s@CaseEventIncludedData' {} [FieldIdentifier]
a -> CaseEventIncludedData
s {$sel:fields:CaseEventIncludedData' :: [FieldIdentifier]
fields = [FieldIdentifier]
a} :: CaseEventIncludedData) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON CaseEventIncludedData where
  parseJSON :: Value -> Parser CaseEventIncludedData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CaseEventIncludedData"
      ( \Object
x ->
          [FieldIdentifier] -> CaseEventIncludedData
CaseEventIncludedData'
            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
"fields" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CaseEventIncludedData where
  hashWithSalt :: Int -> CaseEventIncludedData -> Int
hashWithSalt Int
_salt CaseEventIncludedData' {[FieldIdentifier]
fields :: [FieldIdentifier]
$sel:fields:CaseEventIncludedData' :: CaseEventIncludedData -> [FieldIdentifier]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [FieldIdentifier]
fields

instance Prelude.NFData CaseEventIncludedData where
  rnf :: CaseEventIncludedData -> ()
rnf CaseEventIncludedData' {[FieldIdentifier]
fields :: [FieldIdentifier]
$sel:fields:CaseEventIncludedData' :: CaseEventIncludedData -> [FieldIdentifier]
..} = forall a. NFData a => a -> ()
Prelude.rnf [FieldIdentifier]
fields

instance Data.ToJSON CaseEventIncludedData where
  toJSON :: CaseEventIncludedData -> Value
toJSON CaseEventIncludedData' {[FieldIdentifier]
fields :: [FieldIdentifier]
$sel:fields:CaseEventIncludedData' :: CaseEventIncludedData -> [FieldIdentifier]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"fields" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [FieldIdentifier]
fields)]
      )