{-# 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.Document where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Wisdom.Types.ContentReference
import Amazonka.Wisdom.Types.DocumentText
data Document = Document'
{
Document -> Maybe DocumentText
excerpt :: Prelude.Maybe DocumentText,
Document -> Maybe DocumentText
title :: Prelude.Maybe DocumentText,
Document -> ContentReference
contentReference :: ContentReference
}
deriving (Document -> Document -> Bool
(Document -> Document -> Bool)
-> (Document -> Document -> Bool) -> Eq Document
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Document -> Document -> Bool
$c/= :: Document -> Document -> Bool
== :: Document -> Document -> Bool
$c== :: Document -> Document -> Bool
Prelude.Eq, Int -> Document -> ShowS
[Document] -> ShowS
Document -> String
(Int -> Document -> ShowS)
-> (Document -> String) -> ([Document] -> ShowS) -> Show Document
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Document] -> ShowS
$cshowList :: [Document] -> ShowS
show :: Document -> String
$cshow :: Document -> String
showsPrec :: Int -> Document -> ShowS
$cshowsPrec :: Int -> Document -> ShowS
Prelude.Show, (forall x. Document -> Rep Document x)
-> (forall x. Rep Document x -> Document) -> Generic Document
forall x. Rep Document x -> Document
forall x. Document -> Rep Document x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Document x -> Document
$cfrom :: forall x. Document -> Rep Document x
Prelude.Generic)
newDocument ::
ContentReference ->
Document
newDocument :: ContentReference -> Document
newDocument ContentReference
pContentReference_ =
Document' :: Maybe DocumentText
-> Maybe DocumentText -> ContentReference -> Document
Document'
{ $sel:excerpt:Document' :: Maybe DocumentText
excerpt = Maybe DocumentText
forall a. Maybe a
Prelude.Nothing,
$sel:title:Document' :: Maybe DocumentText
title = Maybe DocumentText
forall a. Maybe a
Prelude.Nothing,
$sel:contentReference:Document' :: ContentReference
contentReference = ContentReference
pContentReference_
}
document_excerpt :: Lens.Lens' Document (Prelude.Maybe DocumentText)
document_excerpt :: (Maybe DocumentText -> f (Maybe DocumentText))
-> Document -> f Document
document_excerpt = (Document -> Maybe DocumentText)
-> (Document -> Maybe DocumentText -> Document)
-> Lens Document Document (Maybe DocumentText) (Maybe DocumentText)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe DocumentText
excerpt :: Maybe DocumentText
$sel:excerpt:Document' :: Document -> Maybe DocumentText
excerpt} -> Maybe DocumentText
excerpt) (\s :: Document
s@Document' {} Maybe DocumentText
a -> Document
s {$sel:excerpt:Document' :: Maybe DocumentText
excerpt = Maybe DocumentText
a} :: Document)
document_title :: Lens.Lens' Document (Prelude.Maybe DocumentText)
document_title :: (Maybe DocumentText -> f (Maybe DocumentText))
-> Document -> f Document
document_title = (Document -> Maybe DocumentText)
-> (Document -> Maybe DocumentText -> Document)
-> Lens Document Document (Maybe DocumentText) (Maybe DocumentText)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe DocumentText
title :: Maybe DocumentText
$sel:title:Document' :: Document -> Maybe DocumentText
title} -> Maybe DocumentText
title) (\s :: Document
s@Document' {} Maybe DocumentText
a -> Document
s {$sel:title:Document' :: Maybe DocumentText
title = Maybe DocumentText
a} :: Document)
document_contentReference :: Lens.Lens' Document ContentReference
document_contentReference :: (ContentReference -> f ContentReference) -> Document -> f Document
document_contentReference = (Document -> ContentReference)
-> (Document -> ContentReference -> Document)
-> Lens Document Document ContentReference ContentReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {ContentReference
contentReference :: ContentReference
$sel:contentReference:Document' :: Document -> ContentReference
contentReference} -> ContentReference
contentReference) (\s :: Document
s@Document' {} ContentReference
a -> Document
s {$sel:contentReference:Document' :: ContentReference
contentReference = ContentReference
a} :: Document)
instance Core.FromJSON Document where
parseJSON :: Value -> Parser Document
parseJSON =
String -> (Object -> Parser Document) -> Value -> Parser Document
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Document"
( \Object
x ->
Maybe DocumentText
-> Maybe DocumentText -> ContentReference -> Document
Document'
(Maybe DocumentText
-> Maybe DocumentText -> ContentReference -> Document)
-> Parser (Maybe DocumentText)
-> Parser (Maybe DocumentText -> ContentReference -> Document)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DocumentText)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"excerpt")
Parser (Maybe DocumentText -> ContentReference -> Document)
-> Parser (Maybe DocumentText)
-> Parser (ContentReference -> Document)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DocumentText)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"title")
Parser (ContentReference -> Document)
-> Parser ContentReference -> Parser Document
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ContentReference
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"contentReference")
)
instance Prelude.Hashable Document
instance Prelude.NFData Document