{-# 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.DynamoDB.Types.ContributorInsightsSummary
-- 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.DynamoDB.Types.ContributorInsightsSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.ContributorInsightsStatus
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Represents a Contributor Insights summary entry.
--
-- /See:/ 'newContributorInsightsSummary' smart constructor.
data ContributorInsightsSummary = ContributorInsightsSummary'
  { -- | Describes the current status for contributor insights for the given
    -- table and index, if applicable.
    ContributorInsightsSummary -> Maybe ContributorInsightsStatus
contributorInsightsStatus :: Prelude.Maybe ContributorInsightsStatus,
    -- | Name of the index associated with the summary, if any.
    ContributorInsightsSummary -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | Name of the table associated with the summary.
    ContributorInsightsSummary -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text
  }
  deriving (ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
$c/= :: ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
== :: ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
$c== :: ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
Prelude.Eq, ReadPrec [ContributorInsightsSummary]
ReadPrec ContributorInsightsSummary
Int -> ReadS ContributorInsightsSummary
ReadS [ContributorInsightsSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContributorInsightsSummary]
$creadListPrec :: ReadPrec [ContributorInsightsSummary]
readPrec :: ReadPrec ContributorInsightsSummary
$creadPrec :: ReadPrec ContributorInsightsSummary
readList :: ReadS [ContributorInsightsSummary]
$creadList :: ReadS [ContributorInsightsSummary]
readsPrec :: Int -> ReadS ContributorInsightsSummary
$creadsPrec :: Int -> ReadS ContributorInsightsSummary
Prelude.Read, Int -> ContributorInsightsSummary -> ShowS
[ContributorInsightsSummary] -> ShowS
ContributorInsightsSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContributorInsightsSummary] -> ShowS
$cshowList :: [ContributorInsightsSummary] -> ShowS
show :: ContributorInsightsSummary -> String
$cshow :: ContributorInsightsSummary -> String
showsPrec :: Int -> ContributorInsightsSummary -> ShowS
$cshowsPrec :: Int -> ContributorInsightsSummary -> ShowS
Prelude.Show, forall x.
Rep ContributorInsightsSummary x -> ContributorInsightsSummary
forall x.
ContributorInsightsSummary -> Rep ContributorInsightsSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContributorInsightsSummary x -> ContributorInsightsSummary
$cfrom :: forall x.
ContributorInsightsSummary -> Rep ContributorInsightsSummary x
Prelude.Generic)

-- |
-- Create a value of 'ContributorInsightsSummary' 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:
--
-- 'contributorInsightsStatus', 'contributorInsightsSummary_contributorInsightsStatus' - Describes the current status for contributor insights for the given
-- table and index, if applicable.
--
-- 'indexName', 'contributorInsightsSummary_indexName' - Name of the index associated with the summary, if any.
--
-- 'tableName', 'contributorInsightsSummary_tableName' - Name of the table associated with the summary.
newContributorInsightsSummary ::
  ContributorInsightsSummary
newContributorInsightsSummary :: ContributorInsightsSummary
newContributorInsightsSummary =
  ContributorInsightsSummary'
    { $sel:contributorInsightsStatus:ContributorInsightsSummary' :: Maybe ContributorInsightsStatus
contributorInsightsStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:ContributorInsightsSummary' :: Maybe Text
indexName = forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:ContributorInsightsSummary' :: Maybe Text
tableName = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the current status for contributor insights for the given
-- table and index, if applicable.
contributorInsightsSummary_contributorInsightsStatus :: Lens.Lens' ContributorInsightsSummary (Prelude.Maybe ContributorInsightsStatus)
contributorInsightsSummary_contributorInsightsStatus :: Lens' ContributorInsightsSummary (Maybe ContributorInsightsStatus)
contributorInsightsSummary_contributorInsightsStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContributorInsightsSummary' {Maybe ContributorInsightsStatus
contributorInsightsStatus :: Maybe ContributorInsightsStatus
$sel:contributorInsightsStatus:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe ContributorInsightsStatus
contributorInsightsStatus} -> Maybe ContributorInsightsStatus
contributorInsightsStatus) (\s :: ContributorInsightsSummary
s@ContributorInsightsSummary' {} Maybe ContributorInsightsStatus
a -> ContributorInsightsSummary
s {$sel:contributorInsightsStatus:ContributorInsightsSummary' :: Maybe ContributorInsightsStatus
contributorInsightsStatus = Maybe ContributorInsightsStatus
a} :: ContributorInsightsSummary)

-- | Name of the index associated with the summary, if any.
contributorInsightsSummary_indexName :: Lens.Lens' ContributorInsightsSummary (Prelude.Maybe Prelude.Text)
contributorInsightsSummary_indexName :: Lens' ContributorInsightsSummary (Maybe Text)
contributorInsightsSummary_indexName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContributorInsightsSummary' {Maybe Text
indexName :: Maybe Text
$sel:indexName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: ContributorInsightsSummary
s@ContributorInsightsSummary' {} Maybe Text
a -> ContributorInsightsSummary
s {$sel:indexName:ContributorInsightsSummary' :: Maybe Text
indexName = Maybe Text
a} :: ContributorInsightsSummary)

-- | Name of the table associated with the summary.
contributorInsightsSummary_tableName :: Lens.Lens' ContributorInsightsSummary (Prelude.Maybe Prelude.Text)
contributorInsightsSummary_tableName :: Lens' ContributorInsightsSummary (Maybe Text)
contributorInsightsSummary_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContributorInsightsSummary' {Maybe Text
tableName :: Maybe Text
$sel:tableName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: ContributorInsightsSummary
s@ContributorInsightsSummary' {} Maybe Text
a -> ContributorInsightsSummary
s {$sel:tableName:ContributorInsightsSummary' :: Maybe Text
tableName = Maybe Text
a} :: ContributorInsightsSummary)

instance Data.FromJSON ContributorInsightsSummary where
  parseJSON :: Value -> Parser ContributorInsightsSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContributorInsightsSummary"
      ( \Object
x ->
          Maybe ContributorInsightsStatus
-> Maybe Text -> Maybe Text -> ContributorInsightsSummary
ContributorInsightsSummary'
            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
"ContributorInsightsStatus")
            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
"IndexName")
            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
"TableName")
      )

instance Prelude.Hashable ContributorInsightsSummary where
  hashWithSalt :: Int -> ContributorInsightsSummary -> Int
hashWithSalt Int
_salt ContributorInsightsSummary' {Maybe Text
Maybe ContributorInsightsStatus
tableName :: Maybe Text
indexName :: Maybe Text
contributorInsightsStatus :: Maybe ContributorInsightsStatus
$sel:tableName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
$sel:indexName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
$sel:contributorInsightsStatus:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe ContributorInsightsStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContributorInsightsStatus
contributorInsightsStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
indexName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tableName

instance Prelude.NFData ContributorInsightsSummary where
  rnf :: ContributorInsightsSummary -> ()
rnf ContributorInsightsSummary' {Maybe Text
Maybe ContributorInsightsStatus
tableName :: Maybe Text
indexName :: Maybe Text
contributorInsightsStatus :: Maybe ContributorInsightsStatus
$sel:tableName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
$sel:indexName:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe Text
$sel:contributorInsightsStatus:ContributorInsightsSummary' :: ContributorInsightsSummary -> Maybe ContributorInsightsStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContributorInsightsStatus
contributorInsightsStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
indexName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tableName