{-# 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.LexV2Models.Types.IntentSortBy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.IntentSortAttribute
import Amazonka.LexV2Models.Types.SortOrder
import qualified Amazonka.Prelude as Prelude
data IntentSortBy = IntentSortBy'
{
IntentSortBy -> IntentSortAttribute
attribute :: IntentSortAttribute,
IntentSortBy -> SortOrder
order :: SortOrder
}
deriving (IntentSortBy -> IntentSortBy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntentSortBy -> IntentSortBy -> Bool
$c/= :: IntentSortBy -> IntentSortBy -> Bool
== :: IntentSortBy -> IntentSortBy -> Bool
$c== :: IntentSortBy -> IntentSortBy -> Bool
Prelude.Eq, ReadPrec [IntentSortBy]
ReadPrec IntentSortBy
Int -> ReadS IntentSortBy
ReadS [IntentSortBy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntentSortBy]
$creadListPrec :: ReadPrec [IntentSortBy]
readPrec :: ReadPrec IntentSortBy
$creadPrec :: ReadPrec IntentSortBy
readList :: ReadS [IntentSortBy]
$creadList :: ReadS [IntentSortBy]
readsPrec :: Int -> ReadS IntentSortBy
$creadsPrec :: Int -> ReadS IntentSortBy
Prelude.Read, Int -> IntentSortBy -> ShowS
[IntentSortBy] -> ShowS
IntentSortBy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntentSortBy] -> ShowS
$cshowList :: [IntentSortBy] -> ShowS
show :: IntentSortBy -> String
$cshow :: IntentSortBy -> String
showsPrec :: Int -> IntentSortBy -> ShowS
$cshowsPrec :: Int -> IntentSortBy -> ShowS
Prelude.Show, forall x. Rep IntentSortBy x -> IntentSortBy
forall x. IntentSortBy -> Rep IntentSortBy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntentSortBy x -> IntentSortBy
$cfrom :: forall x. IntentSortBy -> Rep IntentSortBy x
Prelude.Generic)
newIntentSortBy ::
IntentSortAttribute ->
SortOrder ->
IntentSortBy
newIntentSortBy :: IntentSortAttribute -> SortOrder -> IntentSortBy
newIntentSortBy IntentSortAttribute
pAttribute_ SortOrder
pOrder_ =
IntentSortBy'
{ $sel:attribute:IntentSortBy' :: IntentSortAttribute
attribute = IntentSortAttribute
pAttribute_,
$sel:order:IntentSortBy' :: SortOrder
order = SortOrder
pOrder_
}
intentSortBy_attribute :: Lens.Lens' IntentSortBy IntentSortAttribute
intentSortBy_attribute :: Lens' IntentSortBy IntentSortAttribute
intentSortBy_attribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSortBy' {IntentSortAttribute
attribute :: IntentSortAttribute
$sel:attribute:IntentSortBy' :: IntentSortBy -> IntentSortAttribute
attribute} -> IntentSortAttribute
attribute) (\s :: IntentSortBy
s@IntentSortBy' {} IntentSortAttribute
a -> IntentSortBy
s {$sel:attribute:IntentSortBy' :: IntentSortAttribute
attribute = IntentSortAttribute
a} :: IntentSortBy)
intentSortBy_order :: Lens.Lens' IntentSortBy SortOrder
intentSortBy_order :: Lens' IntentSortBy SortOrder
intentSortBy_order = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentSortBy' {SortOrder
order :: SortOrder
$sel:order:IntentSortBy' :: IntentSortBy -> SortOrder
order} -> SortOrder
order) (\s :: IntentSortBy
s@IntentSortBy' {} SortOrder
a -> IntentSortBy
s {$sel:order:IntentSortBy' :: SortOrder
order = SortOrder
a} :: IntentSortBy)
instance Prelude.Hashable IntentSortBy where
hashWithSalt :: Int -> IntentSortBy -> Int
hashWithSalt Int
_salt IntentSortBy' {IntentSortAttribute
SortOrder
order :: SortOrder
attribute :: IntentSortAttribute
$sel:order:IntentSortBy' :: IntentSortBy -> SortOrder
$sel:attribute:IntentSortBy' :: IntentSortBy -> IntentSortAttribute
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` IntentSortAttribute
attribute
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SortOrder
order
instance Prelude.NFData IntentSortBy where
rnf :: IntentSortBy -> ()
rnf IntentSortBy' {IntentSortAttribute
SortOrder
order :: SortOrder
attribute :: IntentSortAttribute
$sel:order:IntentSortBy' :: IntentSortBy -> SortOrder
$sel:attribute:IntentSortBy' :: IntentSortBy -> IntentSortAttribute
..} =
forall a. NFData a => a -> ()
Prelude.rnf IntentSortAttribute
attribute
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SortOrder
order
instance Data.ToJSON IntentSortBy where
toJSON :: IntentSortBy -> Value
toJSON IntentSortBy' {IntentSortAttribute
SortOrder
order :: SortOrder
attribute :: IntentSortAttribute
$sel:order:IntentSortBy' :: IntentSortBy -> SortOrder
$sel:attribute:IntentSortBy' :: IntentSortBy -> IntentSortAttribute
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"attribute" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= IntentSortAttribute
attribute),
forall a. a -> Maybe a
Prelude.Just (Key
"order" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SortOrder
order)
]
)