{-# 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.SlotPriority where
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 SlotPriority = SlotPriority'
{
SlotPriority -> Natural
priority :: Prelude.Natural,
SlotPriority -> Text
slotId :: Prelude.Text
}
deriving (SlotPriority -> SlotPriority -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotPriority -> SlotPriority -> Bool
$c/= :: SlotPriority -> SlotPriority -> Bool
== :: SlotPriority -> SlotPriority -> Bool
$c== :: SlotPriority -> SlotPriority -> Bool
Prelude.Eq, ReadPrec [SlotPriority]
ReadPrec SlotPriority
Int -> ReadS SlotPriority
ReadS [SlotPriority]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlotPriority]
$creadListPrec :: ReadPrec [SlotPriority]
readPrec :: ReadPrec SlotPriority
$creadPrec :: ReadPrec SlotPriority
readList :: ReadS [SlotPriority]
$creadList :: ReadS [SlotPriority]
readsPrec :: Int -> ReadS SlotPriority
$creadsPrec :: Int -> ReadS SlotPriority
Prelude.Read, Int -> SlotPriority -> ShowS
[SlotPriority] -> ShowS
SlotPriority -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotPriority] -> ShowS
$cshowList :: [SlotPriority] -> ShowS
show :: SlotPriority -> String
$cshow :: SlotPriority -> String
showsPrec :: Int -> SlotPriority -> ShowS
$cshowsPrec :: Int -> SlotPriority -> ShowS
Prelude.Show, forall x. Rep SlotPriority x -> SlotPriority
forall x. SlotPriority -> Rep SlotPriority x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlotPriority x -> SlotPriority
$cfrom :: forall x. SlotPriority -> Rep SlotPriority x
Prelude.Generic)
newSlotPriority ::
Prelude.Natural ->
Prelude.Text ->
SlotPriority
newSlotPriority :: Natural -> Text -> SlotPriority
newSlotPriority Natural
pPriority_ Text
pSlotId_ =
SlotPriority'
{ $sel:priority:SlotPriority' :: Natural
priority = Natural
pPriority_,
$sel:slotId:SlotPriority' :: Text
slotId = Text
pSlotId_
}
slotPriority_priority :: Lens.Lens' SlotPriority Prelude.Natural
slotPriority_priority :: Lens' SlotPriority Natural
slotPriority_priority = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotPriority' {Natural
priority :: Natural
$sel:priority:SlotPriority' :: SlotPriority -> Natural
priority} -> Natural
priority) (\s :: SlotPriority
s@SlotPriority' {} Natural
a -> SlotPriority
s {$sel:priority:SlotPriority' :: Natural
priority = Natural
a} :: SlotPriority)
slotPriority_slotId :: Lens.Lens' SlotPriority Prelude.Text
slotPriority_slotId :: Lens' SlotPriority Text
slotPriority_slotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotPriority' {Text
slotId :: Text
$sel:slotId:SlotPriority' :: SlotPriority -> Text
slotId} -> Text
slotId) (\s :: SlotPriority
s@SlotPriority' {} Text
a -> SlotPriority
s {$sel:slotId:SlotPriority' :: Text
slotId = Text
a} :: SlotPriority)
instance Data.FromJSON SlotPriority where
parseJSON :: Value -> Parser SlotPriority
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SlotPriority"
( \Object
x ->
Natural -> Text -> SlotPriority
SlotPriority'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"priority")
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
"slotId")
)
instance Prelude.Hashable SlotPriority where
hashWithSalt :: Int -> SlotPriority -> Int
hashWithSalt Int
_salt SlotPriority' {Natural
Text
slotId :: Text
priority :: Natural
$sel:slotId:SlotPriority' :: SlotPriority -> Text
$sel:priority:SlotPriority' :: SlotPriority -> Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
priority
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
slotId
instance Prelude.NFData SlotPriority where
rnf :: SlotPriority -> ()
rnf SlotPriority' {Natural
Text
slotId :: Text
priority :: Natural
$sel:slotId:SlotPriority' :: SlotPriority -> Text
$sel:priority:SlotPriority' :: SlotPriority -> Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Natural
priority
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
slotId
instance Data.ToJSON SlotPriority where
toJSON :: SlotPriority -> Value
toJSON SlotPriority' {Natural
Text
slotId :: Text
priority :: Natural
$sel:slotId:SlotPriority' :: SlotPriority -> Text
$sel:priority:SlotPriority' :: SlotPriority -> Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"priority" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
priority),
forall a. a -> Maybe a
Prelude.Just (Key
"slotId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
slotId)
]
)