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