{-# 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.IndexStatistics
-- 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.IndexStatistics 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.FaqStatistics
import Amazonka.Kendra.Types.TextDocumentStatistics
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the number of documents and the number of
-- questions and answers in an index.
--
-- /See:/ 'newIndexStatistics' smart constructor.
data IndexStatistics = IndexStatistics'
  { -- | The number of question and answer topics in the index.
    IndexStatistics -> FaqStatistics
faqStatistics :: FaqStatistics,
    -- | The number of text documents indexed.
    IndexStatistics -> TextDocumentStatistics
textDocumentStatistics :: TextDocumentStatistics
  }
  deriving (IndexStatistics -> IndexStatistics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IndexStatistics -> IndexStatistics -> Bool
$c/= :: IndexStatistics -> IndexStatistics -> Bool
== :: IndexStatistics -> IndexStatistics -> Bool
$c== :: IndexStatistics -> IndexStatistics -> Bool
Prelude.Eq, ReadPrec [IndexStatistics]
ReadPrec IndexStatistics
Int -> ReadS IndexStatistics
ReadS [IndexStatistics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IndexStatistics]
$creadListPrec :: ReadPrec [IndexStatistics]
readPrec :: ReadPrec IndexStatistics
$creadPrec :: ReadPrec IndexStatistics
readList :: ReadS [IndexStatistics]
$creadList :: ReadS [IndexStatistics]
readsPrec :: Int -> ReadS IndexStatistics
$creadsPrec :: Int -> ReadS IndexStatistics
Prelude.Read, Int -> IndexStatistics -> ShowS
[IndexStatistics] -> ShowS
IndexStatistics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IndexStatistics] -> ShowS
$cshowList :: [IndexStatistics] -> ShowS
show :: IndexStatistics -> String
$cshow :: IndexStatistics -> String
showsPrec :: Int -> IndexStatistics -> ShowS
$cshowsPrec :: Int -> IndexStatistics -> ShowS
Prelude.Show, forall x. Rep IndexStatistics x -> IndexStatistics
forall x. IndexStatistics -> Rep IndexStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IndexStatistics x -> IndexStatistics
$cfrom :: forall x. IndexStatistics -> Rep IndexStatistics x
Prelude.Generic)

-- |
-- Create a value of 'IndexStatistics' 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:
--
-- 'faqStatistics', 'indexStatistics_faqStatistics' - The number of question and answer topics in the index.
--
-- 'textDocumentStatistics', 'indexStatistics_textDocumentStatistics' - The number of text documents indexed.
newIndexStatistics ::
  -- | 'faqStatistics'
  FaqStatistics ->
  -- | 'textDocumentStatistics'
  TextDocumentStatistics ->
  IndexStatistics
newIndexStatistics :: FaqStatistics -> TextDocumentStatistics -> IndexStatistics
newIndexStatistics
  FaqStatistics
pFaqStatistics_
  TextDocumentStatistics
pTextDocumentStatistics_ =
    IndexStatistics'
      { $sel:faqStatistics:IndexStatistics' :: FaqStatistics
faqStatistics = FaqStatistics
pFaqStatistics_,
        $sel:textDocumentStatistics:IndexStatistics' :: TextDocumentStatistics
textDocumentStatistics = TextDocumentStatistics
pTextDocumentStatistics_
      }

-- | The number of question and answer topics in the index.
indexStatistics_faqStatistics :: Lens.Lens' IndexStatistics FaqStatistics
indexStatistics_faqStatistics :: Lens' IndexStatistics FaqStatistics
indexStatistics_faqStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexStatistics' {FaqStatistics
faqStatistics :: FaqStatistics
$sel:faqStatistics:IndexStatistics' :: IndexStatistics -> FaqStatistics
faqStatistics} -> FaqStatistics
faqStatistics) (\s :: IndexStatistics
s@IndexStatistics' {} FaqStatistics
a -> IndexStatistics
s {$sel:faqStatistics:IndexStatistics' :: FaqStatistics
faqStatistics = FaqStatistics
a} :: IndexStatistics)

-- | The number of text documents indexed.
indexStatistics_textDocumentStatistics :: Lens.Lens' IndexStatistics TextDocumentStatistics
indexStatistics_textDocumentStatistics :: Lens' IndexStatistics TextDocumentStatistics
indexStatistics_textDocumentStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexStatistics' {TextDocumentStatistics
textDocumentStatistics :: TextDocumentStatistics
$sel:textDocumentStatistics:IndexStatistics' :: IndexStatistics -> TextDocumentStatistics
textDocumentStatistics} -> TextDocumentStatistics
textDocumentStatistics) (\s :: IndexStatistics
s@IndexStatistics' {} TextDocumentStatistics
a -> IndexStatistics
s {$sel:textDocumentStatistics:IndexStatistics' :: TextDocumentStatistics
textDocumentStatistics = TextDocumentStatistics
a} :: IndexStatistics)

instance Data.FromJSON IndexStatistics where
  parseJSON :: Value -> Parser IndexStatistics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IndexStatistics"
      ( \Object
x ->
          FaqStatistics -> TextDocumentStatistics -> IndexStatistics
IndexStatistics'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FaqStatistics")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TextDocumentStatistics")
      )

instance Prelude.Hashable IndexStatistics where
  hashWithSalt :: Int -> IndexStatistics -> Int
hashWithSalt Int
_salt IndexStatistics' {FaqStatistics
TextDocumentStatistics
textDocumentStatistics :: TextDocumentStatistics
faqStatistics :: FaqStatistics
$sel:textDocumentStatistics:IndexStatistics' :: IndexStatistics -> TextDocumentStatistics
$sel:faqStatistics:IndexStatistics' :: IndexStatistics -> FaqStatistics
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FaqStatistics
faqStatistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TextDocumentStatistics
textDocumentStatistics

instance Prelude.NFData IndexStatistics where
  rnf :: IndexStatistics -> ()
rnf IndexStatistics' {FaqStatistics
TextDocumentStatistics
textDocumentStatistics :: TextDocumentStatistics
faqStatistics :: FaqStatistics
$sel:textDocumentStatistics:IndexStatistics' :: IndexStatistics -> TextDocumentStatistics
$sel:faqStatistics:IndexStatistics' :: IndexStatistics -> FaqStatistics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf FaqStatistics
faqStatistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TextDocumentStatistics
textDocumentStatistics