{-# 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.AmplifyUiBuilder.Types.SectionalElement where
import Amazonka.AmplifyUiBuilder.Types.FieldPosition
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 SectionalElement = SectionalElement'
{
SectionalElement -> Maybe Int
level :: Prelude.Maybe Prelude.Int,
SectionalElement -> Maybe Text
orientation :: Prelude.Maybe Prelude.Text,
SectionalElement -> Maybe FieldPosition
position :: Prelude.Maybe FieldPosition,
SectionalElement -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
SectionalElement -> Text
type' :: Prelude.Text
}
deriving (SectionalElement -> SectionalElement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SectionalElement -> SectionalElement -> Bool
$c/= :: SectionalElement -> SectionalElement -> Bool
== :: SectionalElement -> SectionalElement -> Bool
$c== :: SectionalElement -> SectionalElement -> Bool
Prelude.Eq, ReadPrec [SectionalElement]
ReadPrec SectionalElement
Int -> ReadS SectionalElement
ReadS [SectionalElement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SectionalElement]
$creadListPrec :: ReadPrec [SectionalElement]
readPrec :: ReadPrec SectionalElement
$creadPrec :: ReadPrec SectionalElement
readList :: ReadS [SectionalElement]
$creadList :: ReadS [SectionalElement]
readsPrec :: Int -> ReadS SectionalElement
$creadsPrec :: Int -> ReadS SectionalElement
Prelude.Read, Int -> SectionalElement -> ShowS
[SectionalElement] -> ShowS
SectionalElement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SectionalElement] -> ShowS
$cshowList :: [SectionalElement] -> ShowS
show :: SectionalElement -> String
$cshow :: SectionalElement -> String
showsPrec :: Int -> SectionalElement -> ShowS
$cshowsPrec :: Int -> SectionalElement -> ShowS
Prelude.Show, forall x. Rep SectionalElement x -> SectionalElement
forall x. SectionalElement -> Rep SectionalElement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SectionalElement x -> SectionalElement
$cfrom :: forall x. SectionalElement -> Rep SectionalElement x
Prelude.Generic)
newSectionalElement ::
Prelude.Text ->
SectionalElement
newSectionalElement :: Text -> SectionalElement
newSectionalElement Text
pType_ =
SectionalElement'
{ $sel:level:SectionalElement' :: Maybe Int
level = forall a. Maybe a
Prelude.Nothing,
$sel:orientation:SectionalElement' :: Maybe Text
orientation = forall a. Maybe a
Prelude.Nothing,
$sel:position:SectionalElement' :: Maybe FieldPosition
position = forall a. Maybe a
Prelude.Nothing,
$sel:text:SectionalElement' :: Maybe Text
text = forall a. Maybe a
Prelude.Nothing,
$sel:type':SectionalElement' :: Text
type' = Text
pType_
}
sectionalElement_level :: Lens.Lens' SectionalElement (Prelude.Maybe Prelude.Int)
sectionalElement_level :: Lens' SectionalElement (Maybe Int)
sectionalElement_level = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionalElement' {Maybe Int
level :: Maybe Int
$sel:level:SectionalElement' :: SectionalElement -> Maybe Int
level} -> Maybe Int
level) (\s :: SectionalElement
s@SectionalElement' {} Maybe Int
a -> SectionalElement
s {$sel:level:SectionalElement' :: Maybe Int
level = Maybe Int
a} :: SectionalElement)
sectionalElement_orientation :: Lens.Lens' SectionalElement (Prelude.Maybe Prelude.Text)
sectionalElement_orientation :: Lens' SectionalElement (Maybe Text)
sectionalElement_orientation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionalElement' {Maybe Text
orientation :: Maybe Text
$sel:orientation:SectionalElement' :: SectionalElement -> Maybe Text
orientation} -> Maybe Text
orientation) (\s :: SectionalElement
s@SectionalElement' {} Maybe Text
a -> SectionalElement
s {$sel:orientation:SectionalElement' :: Maybe Text
orientation = Maybe Text
a} :: SectionalElement)
sectionalElement_position :: Lens.Lens' SectionalElement (Prelude.Maybe FieldPosition)
sectionalElement_position :: Lens' SectionalElement (Maybe FieldPosition)
sectionalElement_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionalElement' {Maybe FieldPosition
position :: Maybe FieldPosition
$sel:position:SectionalElement' :: SectionalElement -> Maybe FieldPosition
position} -> Maybe FieldPosition
position) (\s :: SectionalElement
s@SectionalElement' {} Maybe FieldPosition
a -> SectionalElement
s {$sel:position:SectionalElement' :: Maybe FieldPosition
position = Maybe FieldPosition
a} :: SectionalElement)
sectionalElement_text :: Lens.Lens' SectionalElement (Prelude.Maybe Prelude.Text)
sectionalElement_text :: Lens' SectionalElement (Maybe Text)
sectionalElement_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionalElement' {Maybe Text
text :: Maybe Text
$sel:text:SectionalElement' :: SectionalElement -> Maybe Text
text} -> Maybe Text
text) (\s :: SectionalElement
s@SectionalElement' {} Maybe Text
a -> SectionalElement
s {$sel:text:SectionalElement' :: Maybe Text
text = Maybe Text
a} :: SectionalElement)
sectionalElement_type :: Lens.Lens' SectionalElement Prelude.Text
sectionalElement_type :: Lens' SectionalElement Text
sectionalElement_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SectionalElement' {Text
type' :: Text
$sel:type':SectionalElement' :: SectionalElement -> Text
type'} -> Text
type') (\s :: SectionalElement
s@SectionalElement' {} Text
a -> SectionalElement
s {$sel:type':SectionalElement' :: Text
type' = Text
a} :: SectionalElement)
instance Data.FromJSON SectionalElement where
parseJSON :: Value -> Parser SectionalElement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SectionalElement"
( \Object
x ->
Maybe Int
-> Maybe Text
-> Maybe FieldPosition
-> Maybe Text
-> Text
-> SectionalElement
SectionalElement'
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
"level")
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
"orientation")
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
"position")
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
"text")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
)
instance Prelude.Hashable SectionalElement where
hashWithSalt :: Int -> SectionalElement -> Int
hashWithSalt Int
_salt SectionalElement' {Maybe Int
Maybe Text
Maybe FieldPosition
Text
type' :: Text
text :: Maybe Text
position :: Maybe FieldPosition
orientation :: Maybe Text
level :: Maybe Int
$sel:type':SectionalElement' :: SectionalElement -> Text
$sel:text:SectionalElement' :: SectionalElement -> Maybe Text
$sel:position:SectionalElement' :: SectionalElement -> Maybe FieldPosition
$sel:orientation:SectionalElement' :: SectionalElement -> Maybe Text
$sel:level:SectionalElement' :: SectionalElement -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
level
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
orientation
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FieldPosition
position
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
text
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'
instance Prelude.NFData SectionalElement where
rnf :: SectionalElement -> ()
rnf SectionalElement' {Maybe Int
Maybe Text
Maybe FieldPosition
Text
type' :: Text
text :: Maybe Text
position :: Maybe FieldPosition
orientation :: Maybe Text
level :: Maybe Int
$sel:type':SectionalElement' :: SectionalElement -> Text
$sel:text:SectionalElement' :: SectionalElement -> Maybe Text
$sel:position:SectionalElement' :: SectionalElement -> Maybe FieldPosition
$sel:orientation:SectionalElement' :: SectionalElement -> Maybe Text
$sel:level:SectionalElement' :: SectionalElement -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
level
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
orientation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FieldPosition
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
text
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'
instance Data.ToJSON SectionalElement where
toJSON :: SectionalElement -> Value
toJSON SectionalElement' {Maybe Int
Maybe Text
Maybe FieldPosition
Text
type' :: Text
text :: Maybe Text
position :: Maybe FieldPosition
orientation :: Maybe Text
level :: Maybe Int
$sel:type':SectionalElement' :: SectionalElement -> Text
$sel:text:SectionalElement' :: SectionalElement -> Maybe Text
$sel:position:SectionalElement' :: SectionalElement -> Maybe FieldPosition
$sel:orientation:SectionalElement' :: SectionalElement -> Maybe Text
$sel:level:SectionalElement' :: SectionalElement -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"level" 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 Int
level,
(Key
"orientation" 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
orientation,
(Key
"position" 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 FieldPosition
position,
(Key
"text" 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
text,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
type')
]
)