{-# 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.PersonalizeRuntime.Types.PredictedItem where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PredictedItem = PredictedItem'
{
PredictedItem -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
PredictedItem -> Maybe Text
itemId :: Prelude.Maybe Prelude.Text
}
deriving (PredictedItem -> PredictedItem -> Bool
(PredictedItem -> PredictedItem -> Bool)
-> (PredictedItem -> PredictedItem -> Bool) -> Eq PredictedItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredictedItem -> PredictedItem -> Bool
$c/= :: PredictedItem -> PredictedItem -> Bool
== :: PredictedItem -> PredictedItem -> Bool
$c== :: PredictedItem -> PredictedItem -> Bool
Prelude.Eq, ReadPrec [PredictedItem]
ReadPrec PredictedItem
Int -> ReadS PredictedItem
ReadS [PredictedItem]
(Int -> ReadS PredictedItem)
-> ReadS [PredictedItem]
-> ReadPrec PredictedItem
-> ReadPrec [PredictedItem]
-> Read PredictedItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredictedItem]
$creadListPrec :: ReadPrec [PredictedItem]
readPrec :: ReadPrec PredictedItem
$creadPrec :: ReadPrec PredictedItem
readList :: ReadS [PredictedItem]
$creadList :: ReadS [PredictedItem]
readsPrec :: Int -> ReadS PredictedItem
$creadsPrec :: Int -> ReadS PredictedItem
Prelude.Read, Int -> PredictedItem -> ShowS
[PredictedItem] -> ShowS
PredictedItem -> String
(Int -> PredictedItem -> ShowS)
-> (PredictedItem -> String)
-> ([PredictedItem] -> ShowS)
-> Show PredictedItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredictedItem] -> ShowS
$cshowList :: [PredictedItem] -> ShowS
show :: PredictedItem -> String
$cshow :: PredictedItem -> String
showsPrec :: Int -> PredictedItem -> ShowS
$cshowsPrec :: Int -> PredictedItem -> ShowS
Prelude.Show, (forall x. PredictedItem -> Rep PredictedItem x)
-> (forall x. Rep PredictedItem x -> PredictedItem)
-> Generic PredictedItem
forall x. Rep PredictedItem x -> PredictedItem
forall x. PredictedItem -> Rep PredictedItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PredictedItem x -> PredictedItem
$cfrom :: forall x. PredictedItem -> Rep PredictedItem x
Prelude.Generic)
newPredictedItem ::
PredictedItem
newPredictedItem :: PredictedItem
newPredictedItem =
PredictedItem' :: Maybe Double -> Maybe Text -> PredictedItem
PredictedItem'
{ $sel:score:PredictedItem' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:itemId:PredictedItem' :: Maybe Text
itemId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
predictedItem_score :: Lens.Lens' PredictedItem (Prelude.Maybe Prelude.Double)
predictedItem_score :: (Maybe Double -> f (Maybe Double))
-> PredictedItem -> f PredictedItem
predictedItem_score = (PredictedItem -> Maybe Double)
-> (PredictedItem -> Maybe Double -> PredictedItem)
-> Lens PredictedItem PredictedItem (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictedItem' {Maybe Double
score :: Maybe Double
$sel:score:PredictedItem' :: PredictedItem -> Maybe Double
score} -> Maybe Double
score) (\s :: PredictedItem
s@PredictedItem' {} Maybe Double
a -> PredictedItem
s {$sel:score:PredictedItem' :: Maybe Double
score = Maybe Double
a} :: PredictedItem)
predictedItem_itemId :: Lens.Lens' PredictedItem (Prelude.Maybe Prelude.Text)
predictedItem_itemId :: (Maybe Text -> f (Maybe Text)) -> PredictedItem -> f PredictedItem
predictedItem_itemId = (PredictedItem -> Maybe Text)
-> (PredictedItem -> Maybe Text -> PredictedItem)
-> Lens PredictedItem PredictedItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictedItem' {Maybe Text
itemId :: Maybe Text
$sel:itemId:PredictedItem' :: PredictedItem -> Maybe Text
itemId} -> Maybe Text
itemId) (\s :: PredictedItem
s@PredictedItem' {} Maybe Text
a -> PredictedItem
s {$sel:itemId:PredictedItem' :: Maybe Text
itemId = Maybe Text
a} :: PredictedItem)
instance Core.FromJSON PredictedItem where
parseJSON :: Value -> Parser PredictedItem
parseJSON =
String
-> (Object -> Parser PredictedItem)
-> Value
-> Parser PredictedItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PredictedItem"
( \Object
x ->
Maybe Double -> Maybe Text -> PredictedItem
PredictedItem'
(Maybe Double -> Maybe Text -> PredictedItem)
-> Parser (Maybe Double) -> Parser (Maybe Text -> PredictedItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"score")
Parser (Maybe Text -> PredictedItem)
-> Parser (Maybe Text) -> Parser PredictedItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"itemId")
)
instance Prelude.Hashable PredictedItem
instance Prelude.NFData PredictedItem