{-# 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.AlexaBusiness.Types.Sort where
import Amazonka.AlexaBusiness.Types.SortValue
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 Sort = Sort'
{
Sort -> Text
key :: Prelude.Text,
Sort -> SortValue
value :: SortValue
}
deriving (Sort -> Sort -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sort -> Sort -> Bool
$c/= :: Sort -> Sort -> Bool
== :: Sort -> Sort -> Bool
$c== :: Sort -> Sort -> Bool
Prelude.Eq, ReadPrec [Sort]
ReadPrec Sort
Int -> ReadS Sort
ReadS [Sort]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sort]
$creadListPrec :: ReadPrec [Sort]
readPrec :: ReadPrec Sort
$creadPrec :: ReadPrec Sort
readList :: ReadS [Sort]
$creadList :: ReadS [Sort]
readsPrec :: Int -> ReadS Sort
$creadsPrec :: Int -> ReadS Sort
Prelude.Read, Int -> Sort -> ShowS
[Sort] -> ShowS
Sort -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sort] -> ShowS
$cshowList :: [Sort] -> ShowS
show :: Sort -> String
$cshow :: Sort -> String
showsPrec :: Int -> Sort -> ShowS
$cshowsPrec :: Int -> Sort -> ShowS
Prelude.Show, forall x. Rep Sort x -> Sort
forall x. Sort -> Rep Sort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Sort x -> Sort
$cfrom :: forall x. Sort -> Rep Sort x
Prelude.Generic)
newSort ::
Prelude.Text ->
SortValue ->
Sort
newSort :: Text -> SortValue -> Sort
newSort Text
pKey_ SortValue
pValue_ =
Sort' {$sel:key:Sort' :: Text
key = Text
pKey_, $sel:value:Sort' :: SortValue
value = SortValue
pValue_}
sort_key :: Lens.Lens' Sort Prelude.Text
sort_key :: Lens' Sort Text
sort_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sort' {Text
key :: Text
$sel:key:Sort' :: Sort -> Text
key} -> Text
key) (\s :: Sort
s@Sort' {} Text
a -> Sort
s {$sel:key:Sort' :: Text
key = Text
a} :: Sort)
sort_value :: Lens.Lens' Sort SortValue
sort_value :: Lens' Sort SortValue
sort_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sort' {SortValue
value :: SortValue
$sel:value:Sort' :: Sort -> SortValue
value} -> SortValue
value) (\s :: Sort
s@Sort' {} SortValue
a -> Sort
s {$sel:value:Sort' :: SortValue
value = SortValue
a} :: Sort)
instance Prelude.Hashable Sort where
hashWithSalt :: Int -> Sort -> Int
hashWithSalt Int
_salt Sort' {Text
SortValue
value :: SortValue
key :: Text
$sel:value:Sort' :: Sort -> SortValue
$sel:key:Sort' :: Sort -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SortValue
value
instance Prelude.NFData Sort where
rnf :: Sort -> ()
rnf Sort' {Text
SortValue
value :: SortValue
key :: Text
$sel:value:Sort' :: Sort -> SortValue
$sel:key:Sort' :: Sort -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SortValue
value
instance Data.ToJSON Sort where
toJSON :: Sort -> Value
toJSON Sort' {Text
SortValue
value :: SortValue
key :: Text
$sel:value:Sort' :: Sort -> SortValue
$sel:key:Sort' :: Sort -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SortValue
value)
]
)