{-# 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.Wisdom.Types.RecommendationData where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Wisdom.Types.Document
import Amazonka.Wisdom.Types.RelevanceLevel
data RecommendationData = RecommendationData'
{
RecommendationData -> Maybe RelevanceLevel
relevanceLevel :: Prelude.Maybe RelevanceLevel,
RecommendationData -> Maybe Double
relevanceScore :: Prelude.Maybe Prelude.Double,
RecommendationData -> Document
document :: Document,
RecommendationData -> Text
recommendationId :: Prelude.Text
}
deriving (RecommendationData -> RecommendationData -> Bool
(RecommendationData -> RecommendationData -> Bool)
-> (RecommendationData -> RecommendationData -> Bool)
-> Eq RecommendationData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationData -> RecommendationData -> Bool
$c/= :: RecommendationData -> RecommendationData -> Bool
== :: RecommendationData -> RecommendationData -> Bool
$c== :: RecommendationData -> RecommendationData -> Bool
Prelude.Eq, Int -> RecommendationData -> ShowS
[RecommendationData] -> ShowS
RecommendationData -> String
(Int -> RecommendationData -> ShowS)
-> (RecommendationData -> String)
-> ([RecommendationData] -> ShowS)
-> Show RecommendationData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationData] -> ShowS
$cshowList :: [RecommendationData] -> ShowS
show :: RecommendationData -> String
$cshow :: RecommendationData -> String
showsPrec :: Int -> RecommendationData -> ShowS
$cshowsPrec :: Int -> RecommendationData -> ShowS
Prelude.Show, (forall x. RecommendationData -> Rep RecommendationData x)
-> (forall x. Rep RecommendationData x -> RecommendationData)
-> Generic RecommendationData
forall x. Rep RecommendationData x -> RecommendationData
forall x. RecommendationData -> Rep RecommendationData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecommendationData x -> RecommendationData
$cfrom :: forall x. RecommendationData -> Rep RecommendationData x
Prelude.Generic)
newRecommendationData ::
Document ->
Prelude.Text ->
RecommendationData
newRecommendationData :: Document -> Text -> RecommendationData
newRecommendationData Document
pDocument_ Text
pRecommendationId_ =
RecommendationData' :: Maybe RelevanceLevel
-> Maybe Double -> Document -> Text -> RecommendationData
RecommendationData'
{ $sel:relevanceLevel:RecommendationData' :: Maybe RelevanceLevel
relevanceLevel =
Maybe RelevanceLevel
forall a. Maybe a
Prelude.Nothing,
$sel:relevanceScore:RecommendationData' :: Maybe Double
relevanceScore = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:document:RecommendationData' :: Document
document = Document
pDocument_,
$sel:recommendationId:RecommendationData' :: Text
recommendationId = Text
pRecommendationId_
}
recommendationData_relevanceLevel :: Lens.Lens' RecommendationData (Prelude.Maybe RelevanceLevel)
recommendationData_relevanceLevel :: (Maybe RelevanceLevel -> f (Maybe RelevanceLevel))
-> RecommendationData -> f RecommendationData
recommendationData_relevanceLevel = (RecommendationData -> Maybe RelevanceLevel)
-> (RecommendationData
-> Maybe RelevanceLevel -> RecommendationData)
-> Lens
RecommendationData
RecommendationData
(Maybe RelevanceLevel)
(Maybe RelevanceLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationData' {Maybe RelevanceLevel
relevanceLevel :: Maybe RelevanceLevel
$sel:relevanceLevel:RecommendationData' :: RecommendationData -> Maybe RelevanceLevel
relevanceLevel} -> Maybe RelevanceLevel
relevanceLevel) (\s :: RecommendationData
s@RecommendationData' {} Maybe RelevanceLevel
a -> RecommendationData
s {$sel:relevanceLevel:RecommendationData' :: Maybe RelevanceLevel
relevanceLevel = Maybe RelevanceLevel
a} :: RecommendationData)
recommendationData_relevanceScore :: Lens.Lens' RecommendationData (Prelude.Maybe Prelude.Double)
recommendationData_relevanceScore :: (Maybe Double -> f (Maybe Double))
-> RecommendationData -> f RecommendationData
recommendationData_relevanceScore = (RecommendationData -> Maybe Double)
-> (RecommendationData -> Maybe Double -> RecommendationData)
-> Lens
RecommendationData RecommendationData (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationData' {Maybe Double
relevanceScore :: Maybe Double
$sel:relevanceScore:RecommendationData' :: RecommendationData -> Maybe Double
relevanceScore} -> Maybe Double
relevanceScore) (\s :: RecommendationData
s@RecommendationData' {} Maybe Double
a -> RecommendationData
s {$sel:relevanceScore:RecommendationData' :: Maybe Double
relevanceScore = Maybe Double
a} :: RecommendationData)
recommendationData_document :: Lens.Lens' RecommendationData Document
recommendationData_document :: (Document -> f Document)
-> RecommendationData -> f RecommendationData
recommendationData_document = (RecommendationData -> Document)
-> (RecommendationData -> Document -> RecommendationData)
-> Lens RecommendationData RecommendationData Document Document
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationData' {Document
document :: Document
$sel:document:RecommendationData' :: RecommendationData -> Document
document} -> Document
document) (\s :: RecommendationData
s@RecommendationData' {} Document
a -> RecommendationData
s {$sel:document:RecommendationData' :: Document
document = Document
a} :: RecommendationData)
recommendationData_recommendationId :: Lens.Lens' RecommendationData Prelude.Text
recommendationData_recommendationId :: (Text -> f Text) -> RecommendationData -> f RecommendationData
recommendationData_recommendationId = (RecommendationData -> Text)
-> (RecommendationData -> Text -> RecommendationData)
-> Lens RecommendationData RecommendationData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationData' {Text
recommendationId :: Text
$sel:recommendationId:RecommendationData' :: RecommendationData -> Text
recommendationId} -> Text
recommendationId) (\s :: RecommendationData
s@RecommendationData' {} Text
a -> RecommendationData
s {$sel:recommendationId:RecommendationData' :: Text
recommendationId = Text
a} :: RecommendationData)
instance Core.FromJSON RecommendationData where
parseJSON :: Value -> Parser RecommendationData
parseJSON =
String
-> (Object -> Parser RecommendationData)
-> Value
-> Parser RecommendationData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RecommendationData"
( \Object
x ->
Maybe RelevanceLevel
-> Maybe Double -> Document -> Text -> RecommendationData
RecommendationData'
(Maybe RelevanceLevel
-> Maybe Double -> Document -> Text -> RecommendationData)
-> Parser (Maybe RelevanceLevel)
-> Parser (Maybe Double -> Document -> Text -> RecommendationData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RelevanceLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"relevanceLevel")
Parser (Maybe Double -> Document -> Text -> RecommendationData)
-> Parser (Maybe Double)
-> Parser (Document -> Text -> RecommendationData)
forall (f :: * -> *) a b. Applicative f => 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
"relevanceScore")
Parser (Document -> Text -> RecommendationData)
-> Parser Document -> Parser (Text -> RecommendationData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Document
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"document")
Parser (Text -> RecommendationData)
-> Parser Text -> Parser RecommendationData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"recommendationId")
)
instance Prelude.Hashable RecommendationData
instance Prelude.NFData RecommendationData