{-# 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.ComponentDataConfiguration where
import Amazonka.AmplifyUiBuilder.Types.Predicate
import Amazonka.AmplifyUiBuilder.Types.SortProperty
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 ComponentDataConfiguration = ComponentDataConfiguration'
{
ComponentDataConfiguration -> Maybe [Text]
identifiers :: Prelude.Maybe [Prelude.Text],
ComponentDataConfiguration -> Maybe Predicate
predicate :: Prelude.Maybe Predicate,
ComponentDataConfiguration -> Maybe [SortProperty]
sort :: Prelude.Maybe [SortProperty],
ComponentDataConfiguration -> Text
model :: Prelude.Text
}
deriving (ComponentDataConfiguration -> ComponentDataConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentDataConfiguration -> ComponentDataConfiguration -> Bool
$c/= :: ComponentDataConfiguration -> ComponentDataConfiguration -> Bool
== :: ComponentDataConfiguration -> ComponentDataConfiguration -> Bool
$c== :: ComponentDataConfiguration -> ComponentDataConfiguration -> Bool
Prelude.Eq, ReadPrec [ComponentDataConfiguration]
ReadPrec ComponentDataConfiguration
Int -> ReadS ComponentDataConfiguration
ReadS [ComponentDataConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentDataConfiguration]
$creadListPrec :: ReadPrec [ComponentDataConfiguration]
readPrec :: ReadPrec ComponentDataConfiguration
$creadPrec :: ReadPrec ComponentDataConfiguration
readList :: ReadS [ComponentDataConfiguration]
$creadList :: ReadS [ComponentDataConfiguration]
readsPrec :: Int -> ReadS ComponentDataConfiguration
$creadsPrec :: Int -> ReadS ComponentDataConfiguration
Prelude.Read, Int -> ComponentDataConfiguration -> ShowS
[ComponentDataConfiguration] -> ShowS
ComponentDataConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentDataConfiguration] -> ShowS
$cshowList :: [ComponentDataConfiguration] -> ShowS
show :: ComponentDataConfiguration -> String
$cshow :: ComponentDataConfiguration -> String
showsPrec :: Int -> ComponentDataConfiguration -> ShowS
$cshowsPrec :: Int -> ComponentDataConfiguration -> ShowS
Prelude.Show, forall x.
Rep ComponentDataConfiguration x -> ComponentDataConfiguration
forall x.
ComponentDataConfiguration -> Rep ComponentDataConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ComponentDataConfiguration x -> ComponentDataConfiguration
$cfrom :: forall x.
ComponentDataConfiguration -> Rep ComponentDataConfiguration x
Prelude.Generic)
newComponentDataConfiguration ::
Prelude.Text ->
ComponentDataConfiguration
newComponentDataConfiguration :: Text -> ComponentDataConfiguration
newComponentDataConfiguration Text
pModel_ =
ComponentDataConfiguration'
{ $sel:identifiers:ComponentDataConfiguration' :: Maybe [Text]
identifiers =
forall a. Maybe a
Prelude.Nothing,
$sel:predicate:ComponentDataConfiguration' :: Maybe Predicate
predicate = forall a. Maybe a
Prelude.Nothing,
$sel:sort:ComponentDataConfiguration' :: Maybe [SortProperty]
sort = forall a. Maybe a
Prelude.Nothing,
$sel:model:ComponentDataConfiguration' :: Text
model = Text
pModel_
}
componentDataConfiguration_identifiers :: Lens.Lens' ComponentDataConfiguration (Prelude.Maybe [Prelude.Text])
componentDataConfiguration_identifiers :: Lens' ComponentDataConfiguration (Maybe [Text])
componentDataConfiguration_identifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentDataConfiguration' {Maybe [Text]
identifiers :: Maybe [Text]
$sel:identifiers:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [Text]
identifiers} -> Maybe [Text]
identifiers) (\s :: ComponentDataConfiguration
s@ComponentDataConfiguration' {} Maybe [Text]
a -> ComponentDataConfiguration
s {$sel:identifiers:ComponentDataConfiguration' :: Maybe [Text]
identifiers = Maybe [Text]
a} :: ComponentDataConfiguration) 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
componentDataConfiguration_predicate :: Lens.Lens' ComponentDataConfiguration (Prelude.Maybe Predicate)
componentDataConfiguration_predicate :: Lens' ComponentDataConfiguration (Maybe Predicate)
componentDataConfiguration_predicate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentDataConfiguration' {Maybe Predicate
predicate :: Maybe Predicate
$sel:predicate:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe Predicate
predicate} -> Maybe Predicate
predicate) (\s :: ComponentDataConfiguration
s@ComponentDataConfiguration' {} Maybe Predicate
a -> ComponentDataConfiguration
s {$sel:predicate:ComponentDataConfiguration' :: Maybe Predicate
predicate = Maybe Predicate
a} :: ComponentDataConfiguration)
componentDataConfiguration_sort :: Lens.Lens' ComponentDataConfiguration (Prelude.Maybe [SortProperty])
componentDataConfiguration_sort :: Lens' ComponentDataConfiguration (Maybe [SortProperty])
componentDataConfiguration_sort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentDataConfiguration' {Maybe [SortProperty]
sort :: Maybe [SortProperty]
$sel:sort:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [SortProperty]
sort} -> Maybe [SortProperty]
sort) (\s :: ComponentDataConfiguration
s@ComponentDataConfiguration' {} Maybe [SortProperty]
a -> ComponentDataConfiguration
s {$sel:sort:ComponentDataConfiguration' :: Maybe [SortProperty]
sort = Maybe [SortProperty]
a} :: ComponentDataConfiguration) 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
componentDataConfiguration_model :: Lens.Lens' ComponentDataConfiguration Prelude.Text
componentDataConfiguration_model :: Lens' ComponentDataConfiguration Text
componentDataConfiguration_model = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentDataConfiguration' {Text
model :: Text
$sel:model:ComponentDataConfiguration' :: ComponentDataConfiguration -> Text
model} -> Text
model) (\s :: ComponentDataConfiguration
s@ComponentDataConfiguration' {} Text
a -> ComponentDataConfiguration
s {$sel:model:ComponentDataConfiguration' :: Text
model = Text
a} :: ComponentDataConfiguration)
instance Data.FromJSON ComponentDataConfiguration where
parseJSON :: Value -> Parser ComponentDataConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ComponentDataConfiguration"
( \Object
x ->
Maybe [Text]
-> Maybe Predicate
-> Maybe [SortProperty]
-> Text
-> ComponentDataConfiguration
ComponentDataConfiguration'
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
"identifiers" 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
"predicate")
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
"sort" 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 a
Data..: Key
"model")
)
instance Prelude.Hashable ComponentDataConfiguration where
hashWithSalt :: Int -> ComponentDataConfiguration -> Int
hashWithSalt Int
_salt ComponentDataConfiguration' {Maybe [Text]
Maybe [SortProperty]
Maybe Predicate
Text
model :: Text
sort :: Maybe [SortProperty]
predicate :: Maybe Predicate
identifiers :: Maybe [Text]
$sel:model:ComponentDataConfiguration' :: ComponentDataConfiguration -> Text
$sel:sort:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [SortProperty]
$sel:predicate:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe Predicate
$sel:identifiers:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
identifiers
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Predicate
predicate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SortProperty]
sort
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
model
instance Prelude.NFData ComponentDataConfiguration where
rnf :: ComponentDataConfiguration -> ()
rnf ComponentDataConfiguration' {Maybe [Text]
Maybe [SortProperty]
Maybe Predicate
Text
model :: Text
sort :: Maybe [SortProperty]
predicate :: Maybe Predicate
identifiers :: Maybe [Text]
$sel:model:ComponentDataConfiguration' :: ComponentDataConfiguration -> Text
$sel:sort:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [SortProperty]
$sel:predicate:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe Predicate
$sel:identifiers:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
identifiers
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Predicate
predicate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SortProperty]
sort
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
model
instance Data.ToJSON ComponentDataConfiguration where
toJSON :: ComponentDataConfiguration -> Value
toJSON ComponentDataConfiguration' {Maybe [Text]
Maybe [SortProperty]
Maybe Predicate
Text
model :: Text
sort :: Maybe [SortProperty]
predicate :: Maybe Predicate
identifiers :: Maybe [Text]
$sel:model:ComponentDataConfiguration' :: ComponentDataConfiguration -> Text
$sel:sort:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [SortProperty]
$sel:predicate:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe Predicate
$sel:identifiers:ComponentDataConfiguration' :: ComponentDataConfiguration -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"identifiers" 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]
identifiers,
(Key
"predicate" 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 Predicate
predicate,
(Key
"sort" 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 [SortProperty]
sort,
forall a. a -> Maybe a
Prelude.Just (Key
"model" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
model)
]
)