{-# 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 #-}
module Amazonka.ConnectCases.Types.FieldGroup where
import Amazonka.ConnectCases.Types.FieldItem
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
data FieldGroup = FieldGroup'
{
FieldGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
FieldGroup -> [FieldItem]
fields :: [FieldItem]
}
deriving (FieldGroup -> FieldGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldGroup -> FieldGroup -> Bool
$c/= :: FieldGroup -> FieldGroup -> Bool
== :: FieldGroup -> FieldGroup -> Bool
$c== :: FieldGroup -> FieldGroup -> Bool
Prelude.Eq, ReadPrec [FieldGroup]
ReadPrec FieldGroup
Int -> ReadS FieldGroup
ReadS [FieldGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldGroup]
$creadListPrec :: ReadPrec [FieldGroup]
readPrec :: ReadPrec FieldGroup
$creadPrec :: ReadPrec FieldGroup
readList :: ReadS [FieldGroup]
$creadList :: ReadS [FieldGroup]
readsPrec :: Int -> ReadS FieldGroup
$creadsPrec :: Int -> ReadS FieldGroup
Prelude.Read, Int -> FieldGroup -> ShowS
[FieldGroup] -> ShowS
FieldGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldGroup] -> ShowS
$cshowList :: [FieldGroup] -> ShowS
show :: FieldGroup -> String
$cshow :: FieldGroup -> String
showsPrec :: Int -> FieldGroup -> ShowS
$cshowsPrec :: Int -> FieldGroup -> ShowS
Prelude.Show, forall x. Rep FieldGroup x -> FieldGroup
forall x. FieldGroup -> Rep FieldGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldGroup x -> FieldGroup
$cfrom :: forall x. FieldGroup -> Rep FieldGroup x
Prelude.Generic)
newFieldGroup ::
FieldGroup
newFieldGroup :: FieldGroup
newFieldGroup =
FieldGroup'
{ $sel:name:FieldGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:fields:FieldGroup' :: [FieldItem]
fields = forall a. Monoid a => a
Prelude.mempty
}
fieldGroup_name :: Lens.Lens' FieldGroup (Prelude.Maybe Prelude.Text)
fieldGroup_name :: Lens' FieldGroup (Maybe Text)
fieldGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldGroup' {Maybe Text
name :: Maybe Text
$sel:name:FieldGroup' :: FieldGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: FieldGroup
s@FieldGroup' {} Maybe Text
a -> FieldGroup
s {$sel:name:FieldGroup' :: Maybe Text
name = Maybe Text
a} :: FieldGroup)
fieldGroup_fields :: Lens.Lens' FieldGroup [FieldItem]
fieldGroup_fields :: Lens' FieldGroup [FieldItem]
fieldGroup_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldGroup' {[FieldItem]
fields :: [FieldItem]
$sel:fields:FieldGroup' :: FieldGroup -> [FieldItem]
fields} -> [FieldItem]
fields) (\s :: FieldGroup
s@FieldGroup' {} [FieldItem]
a -> FieldGroup
s {$sel:fields:FieldGroup' :: [FieldItem]
fields = [FieldItem]
a} :: FieldGroup) 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 FieldGroup where
parseJSON :: Value -> Parser FieldGroup
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FieldGroup"
( \Object
x ->
Maybe Text -> [FieldItem] -> FieldGroup
FieldGroup'
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
"name")
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
"fields" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable FieldGroup where
hashWithSalt :: Int -> FieldGroup -> Int
hashWithSalt Int
_salt FieldGroup' {[FieldItem]
Maybe Text
fields :: [FieldItem]
name :: Maybe Text
$sel:fields:FieldGroup' :: FieldGroup -> [FieldItem]
$sel:name:FieldGroup' :: FieldGroup -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [FieldItem]
fields
instance Prelude.NFData FieldGroup where
rnf :: FieldGroup -> ()
rnf FieldGroup' {[FieldItem]
Maybe Text
fields :: [FieldItem]
name :: Maybe Text
$sel:fields:FieldGroup' :: FieldGroup -> [FieldItem]
$sel:name:FieldGroup' :: FieldGroup -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [FieldItem]
fields
instance Data.ToJSON FieldGroup where
toJSON :: FieldGroup -> Value
toJSON FieldGroup' {[FieldItem]
Maybe Text
fields :: [FieldItem]
name :: Maybe Text
$sel:fields:FieldGroup' :: FieldGroup -> [FieldItem]
$sel:name:FieldGroup' :: FieldGroup -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"name" 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
name,
forall a. a -> Maybe a
Prelude.Just (Key
"fields" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [FieldItem]
fields)
]
)