{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Wisdom.Types.RecommendationData
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | Information about the recommendation.
--
-- /See:/ 'newRecommendationData' smart constructor.
data RecommendationData = RecommendationData'
  { -- | The relevance level of the recommendation.
    RecommendationData -> Maybe RelevanceLevel
relevanceLevel :: Prelude.Maybe RelevanceLevel,
    -- | The relevance score of the recommendation.
    RecommendationData -> Maybe Double
relevanceScore :: Prelude.Maybe Prelude.Double,
    -- | The recommended document.
    RecommendationData -> Document
document :: Document,
    -- | The identifier of the recommendation.
    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)

-- |
-- Create a value of 'RecommendationData' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'relevanceLevel', 'recommendationData_relevanceLevel' - The relevance level of the recommendation.
--
-- 'relevanceScore', 'recommendationData_relevanceScore' - The relevance score of the recommendation.
--
-- 'document', 'recommendationData_document' - The recommended document.
--
-- 'recommendationId', 'recommendationData_recommendationId' - The identifier of the recommendation.
newRecommendationData ::
  -- | 'document'
  Document ->
  -- | 'recommendationId'
  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_
    }

-- | The relevance level of the recommendation.
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)

-- | The relevance score of the recommendation.
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)

-- | The recommended document.
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)

-- | The identifier of the recommendation.
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