{-# 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.Kendra.Types.FaqSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Kendra.Types.FaqSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.FaqFileFormat
import Amazonka.Kendra.Types.FaqStatus
import qualified Amazonka.Prelude as Prelude

-- | Summary information for frequently asked questions and answers included
-- in an index.
--
-- /See:/ 'newFaqSummary' smart constructor.
data FaqSummary = FaqSummary'
  { -- | The UNIX datetime that the FAQ was added to the index.
    FaqSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The file type used to create the FAQ.
    FaqSummary -> Maybe FaqFileFormat
fileFormat :: Prelude.Maybe FaqFileFormat,
    -- | The identifier of the FAQ.
    FaqSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The code for a language. This shows a supported language for the FAQ
    -- document as part of the summary information for FAQs. English is
    -- supported by default. For more information on supported languages,
    -- including their codes, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
    FaqSummary -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
    -- | The name that you assigned the FAQ when you created or updated the FAQ.
    FaqSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The current status of the FAQ. When the status is @ACTIVE@ the FAQ is
    -- ready for use.
    FaqSummary -> Maybe FaqStatus
status :: Prelude.Maybe FaqStatus,
    -- | The UNIX datetime that the FAQ was last updated.
    FaqSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Data.POSIX
  }
  deriving (FaqSummary -> FaqSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FaqSummary -> FaqSummary -> Bool
$c/= :: FaqSummary -> FaqSummary -> Bool
== :: FaqSummary -> FaqSummary -> Bool
$c== :: FaqSummary -> FaqSummary -> Bool
Prelude.Eq, ReadPrec [FaqSummary]
ReadPrec FaqSummary
Int -> ReadS FaqSummary
ReadS [FaqSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FaqSummary]
$creadListPrec :: ReadPrec [FaqSummary]
readPrec :: ReadPrec FaqSummary
$creadPrec :: ReadPrec FaqSummary
readList :: ReadS [FaqSummary]
$creadList :: ReadS [FaqSummary]
readsPrec :: Int -> ReadS FaqSummary
$creadsPrec :: Int -> ReadS FaqSummary
Prelude.Read, Int -> FaqSummary -> ShowS
[FaqSummary] -> ShowS
FaqSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FaqSummary] -> ShowS
$cshowList :: [FaqSummary] -> ShowS
show :: FaqSummary -> String
$cshow :: FaqSummary -> String
showsPrec :: Int -> FaqSummary -> ShowS
$cshowsPrec :: Int -> FaqSummary -> ShowS
Prelude.Show, forall x. Rep FaqSummary x -> FaqSummary
forall x. FaqSummary -> Rep FaqSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FaqSummary x -> FaqSummary
$cfrom :: forall x. FaqSummary -> Rep FaqSummary x
Prelude.Generic)

-- |
-- Create a value of 'FaqSummary' 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:
--
-- 'createdAt', 'faqSummary_createdAt' - The UNIX datetime that the FAQ was added to the index.
--
-- 'fileFormat', 'faqSummary_fileFormat' - The file type used to create the FAQ.
--
-- 'id', 'faqSummary_id' - The identifier of the FAQ.
--
-- 'languageCode', 'faqSummary_languageCode' - The code for a language. This shows a supported language for the FAQ
-- document as part of the summary information for FAQs. English is
-- supported by default. For more information on supported languages,
-- including their codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
--
-- 'name', 'faqSummary_name' - The name that you assigned the FAQ when you created or updated the FAQ.
--
-- 'status', 'faqSummary_status' - The current status of the FAQ. When the status is @ACTIVE@ the FAQ is
-- ready for use.
--
-- 'updatedAt', 'faqSummary_updatedAt' - The UNIX datetime that the FAQ was last updated.
newFaqSummary ::
  FaqSummary
newFaqSummary :: FaqSummary
newFaqSummary =
  FaqSummary'
    { $sel:createdAt:FaqSummary' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:fileFormat:FaqSummary' :: Maybe FaqFileFormat
fileFormat = forall a. Maybe a
Prelude.Nothing,
      $sel:id:FaqSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:FaqSummary' :: Maybe Text
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:name:FaqSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:FaqSummary' :: Maybe FaqStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:FaqSummary' :: Maybe POSIX
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The UNIX datetime that the FAQ was added to the index.
faqSummary_createdAt :: Lens.Lens' FaqSummary (Prelude.Maybe Prelude.UTCTime)
faqSummary_createdAt :: Lens' FaqSummary (Maybe UTCTime)
faqSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:FaqSummary' :: FaqSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: FaqSummary
s@FaqSummary' {} Maybe POSIX
a -> FaqSummary
s {$sel:createdAt:FaqSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: FaqSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The file type used to create the FAQ.
faqSummary_fileFormat :: Lens.Lens' FaqSummary (Prelude.Maybe FaqFileFormat)
faqSummary_fileFormat :: Lens' FaqSummary (Maybe FaqFileFormat)
faqSummary_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe FaqFileFormat
fileFormat :: Maybe FaqFileFormat
$sel:fileFormat:FaqSummary' :: FaqSummary -> Maybe FaqFileFormat
fileFormat} -> Maybe FaqFileFormat
fileFormat) (\s :: FaqSummary
s@FaqSummary' {} Maybe FaqFileFormat
a -> FaqSummary
s {$sel:fileFormat:FaqSummary' :: Maybe FaqFileFormat
fileFormat = Maybe FaqFileFormat
a} :: FaqSummary)

-- | The identifier of the FAQ.
faqSummary_id :: Lens.Lens' FaqSummary (Prelude.Maybe Prelude.Text)
faqSummary_id :: Lens' FaqSummary (Maybe Text)
faqSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe Text
id :: Maybe Text
$sel:id:FaqSummary' :: FaqSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: FaqSummary
s@FaqSummary' {} Maybe Text
a -> FaqSummary
s {$sel:id:FaqSummary' :: Maybe Text
id = Maybe Text
a} :: FaqSummary)

-- | The code for a language. This shows a supported language for the FAQ
-- document as part of the summary information for FAQs. English is
-- supported by default. For more information on supported languages,
-- including their codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
faqSummary_languageCode :: Lens.Lens' FaqSummary (Prelude.Maybe Prelude.Text)
faqSummary_languageCode :: Lens' FaqSummary (Maybe Text)
faqSummary_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:FaqSummary' :: FaqSummary -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: FaqSummary
s@FaqSummary' {} Maybe Text
a -> FaqSummary
s {$sel:languageCode:FaqSummary' :: Maybe Text
languageCode = Maybe Text
a} :: FaqSummary)

-- | The name that you assigned the FAQ when you created or updated the FAQ.
faqSummary_name :: Lens.Lens' FaqSummary (Prelude.Maybe Prelude.Text)
faqSummary_name :: Lens' FaqSummary (Maybe Text)
faqSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe Text
name :: Maybe Text
$sel:name:FaqSummary' :: FaqSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: FaqSummary
s@FaqSummary' {} Maybe Text
a -> FaqSummary
s {$sel:name:FaqSummary' :: Maybe Text
name = Maybe Text
a} :: FaqSummary)

-- | The current status of the FAQ. When the status is @ACTIVE@ the FAQ is
-- ready for use.
faqSummary_status :: Lens.Lens' FaqSummary (Prelude.Maybe FaqStatus)
faqSummary_status :: Lens' FaqSummary (Maybe FaqStatus)
faqSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe FaqStatus
status :: Maybe FaqStatus
$sel:status:FaqSummary' :: FaqSummary -> Maybe FaqStatus
status} -> Maybe FaqStatus
status) (\s :: FaqSummary
s@FaqSummary' {} Maybe FaqStatus
a -> FaqSummary
s {$sel:status:FaqSummary' :: Maybe FaqStatus
status = Maybe FaqStatus
a} :: FaqSummary)

-- | The UNIX datetime that the FAQ was last updated.
faqSummary_updatedAt :: Lens.Lens' FaqSummary (Prelude.Maybe Prelude.UTCTime)
faqSummary_updatedAt :: Lens' FaqSummary (Maybe UTCTime)
faqSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaqSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:FaqSummary' :: FaqSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: FaqSummary
s@FaqSummary' {} Maybe POSIX
a -> FaqSummary
s {$sel:updatedAt:FaqSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: FaqSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON FaqSummary where
  parseJSON :: Value -> Parser FaqSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FaqSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe FaqFileFormat
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe FaqStatus
-> Maybe POSIX
-> FaqSummary
FaqSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FileFormat")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LanguageCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UpdatedAt")
      )

instance Prelude.Hashable FaqSummary where
  hashWithSalt :: Int -> FaqSummary -> Int
hashWithSalt Int
_salt FaqSummary' {Maybe Text
Maybe POSIX
Maybe FaqFileFormat
Maybe FaqStatus
updatedAt :: Maybe POSIX
status :: Maybe FaqStatus
name :: Maybe Text
languageCode :: Maybe Text
id :: Maybe Text
fileFormat :: Maybe FaqFileFormat
createdAt :: Maybe POSIX
$sel:updatedAt:FaqSummary' :: FaqSummary -> Maybe POSIX
$sel:status:FaqSummary' :: FaqSummary -> Maybe FaqStatus
$sel:name:FaqSummary' :: FaqSummary -> Maybe Text
$sel:languageCode:FaqSummary' :: FaqSummary -> Maybe Text
$sel:id:FaqSummary' :: FaqSummary -> Maybe Text
$sel:fileFormat:FaqSummary' :: FaqSummary -> Maybe FaqFileFormat
$sel:createdAt:FaqSummary' :: FaqSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FaqFileFormat
fileFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FaqStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedAt

instance Prelude.NFData FaqSummary where
  rnf :: FaqSummary -> ()
rnf FaqSummary' {Maybe Text
Maybe POSIX
Maybe FaqFileFormat
Maybe FaqStatus
updatedAt :: Maybe POSIX
status :: Maybe FaqStatus
name :: Maybe Text
languageCode :: Maybe Text
id :: Maybe Text
fileFormat :: Maybe FaqFileFormat
createdAt :: Maybe POSIX
$sel:updatedAt:FaqSummary' :: FaqSummary -> Maybe POSIX
$sel:status:FaqSummary' :: FaqSummary -> Maybe FaqStatus
$sel:name:FaqSummary' :: FaqSummary -> Maybe Text
$sel:languageCode:FaqSummary' :: FaqSummary -> Maybe Text
$sel:id:FaqSummary' :: FaqSummary -> Maybe Text
$sel:fileFormat:FaqSummary' :: FaqSummary -> Maybe FaqFileFormat
$sel:createdAt:FaqSummary' :: FaqSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FaqFileFormat
fileFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FaqStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedAt