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

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.ContributorInsightsStatus
import qualified Amazonka.Lens as Lens
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 table associated with the summary.
    ContributorInsightsSummary -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text,
    -- | Name of the index associated with the summary, if any.
    ContributorInsightsSummary -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (ContributorInsightsSummary -> ContributorInsightsSummary -> Bool
(ContributorInsightsSummary -> ContributorInsightsSummary -> Bool)
-> (ContributorInsightsSummary
    -> ContributorInsightsSummary -> Bool)
-> Eq ContributorInsightsSummary
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]
(Int -> ReadS ContributorInsightsSummary)
-> ReadS [ContributorInsightsSummary]
-> ReadPrec ContributorInsightsSummary
-> ReadPrec [ContributorInsightsSummary]
-> Read 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
(Int -> ContributorInsightsSummary -> ShowS)
-> (ContributorInsightsSummary -> String)
-> ([ContributorInsightsSummary] -> ShowS)
-> Show ContributorInsightsSummary
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.
 ContributorInsightsSummary -> Rep ContributorInsightsSummary x)
-> (forall x.
    Rep ContributorInsightsSummary x -> ContributorInsightsSummary)
-> Generic ContributorInsightsSummary
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.
--
-- 'tableName', 'contributorInsightsSummary_tableName' - Name of the table associated with the summary.
--
-- 'indexName', 'contributorInsightsSummary_indexName' - Name of the index associated with the summary, if any.
newContributorInsightsSummary ::
  ContributorInsightsSummary
newContributorInsightsSummary :: ContributorInsightsSummary
newContributorInsightsSummary =
  ContributorInsightsSummary' :: Maybe ContributorInsightsStatus
-> Maybe Text -> Maybe Text -> ContributorInsightsSummary
ContributorInsightsSummary'
    { $sel:contributorInsightsStatus:ContributorInsightsSummary' :: Maybe ContributorInsightsStatus
contributorInsightsStatus =
        Maybe ContributorInsightsStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:ContributorInsightsSummary' :: Maybe Text
tableName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:ContributorInsightsSummary' :: Maybe Text
indexName = Maybe Text
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 :: (Maybe ContributorInsightsStatus
 -> f (Maybe ContributorInsightsStatus))
-> ContributorInsightsSummary -> f ContributorInsightsSummary
contributorInsightsSummary_contributorInsightsStatus = (ContributorInsightsSummary -> Maybe ContributorInsightsStatus)
-> (ContributorInsightsSummary
    -> Maybe ContributorInsightsStatus -> ContributorInsightsSummary)
-> Lens
     ContributorInsightsSummary
     ContributorInsightsSummary
     (Maybe ContributorInsightsStatus)
     (Maybe 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 table associated with the summary.
contributorInsightsSummary_tableName :: Lens.Lens' ContributorInsightsSummary (Prelude.Maybe Prelude.Text)
contributorInsightsSummary_tableName :: (Maybe Text -> f (Maybe Text))
-> ContributorInsightsSummary -> f ContributorInsightsSummary
contributorInsightsSummary_tableName = (ContributorInsightsSummary -> Maybe Text)
-> (ContributorInsightsSummary
    -> Maybe Text -> ContributorInsightsSummary)
-> Lens
     ContributorInsightsSummary
     ContributorInsightsSummary
     (Maybe Text)
     (Maybe Text)
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)

-- | Name of the index associated with the summary, if any.
contributorInsightsSummary_indexName :: Lens.Lens' ContributorInsightsSummary (Prelude.Maybe Prelude.Text)
contributorInsightsSummary_indexName :: (Maybe Text -> f (Maybe Text))
-> ContributorInsightsSummary -> f ContributorInsightsSummary
contributorInsightsSummary_indexName = (ContributorInsightsSummary -> Maybe Text)
-> (ContributorInsightsSummary
    -> Maybe Text -> ContributorInsightsSummary)
-> Lens
     ContributorInsightsSummary
     ContributorInsightsSummary
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON ContributorInsightsSummary where
  parseJSON :: Value -> Parser ContributorInsightsSummary
parseJSON =
    String
-> (Object -> Parser ContributorInsightsSummary)
-> Value
-> Parser ContributorInsightsSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContributorInsightsSummary"
      ( \Object
x ->
          Maybe ContributorInsightsStatus
-> Maybe Text -> Maybe Text -> ContributorInsightsSummary
ContributorInsightsSummary'
            (Maybe ContributorInsightsStatus
 -> Maybe Text -> Maybe Text -> ContributorInsightsSummary)
-> Parser (Maybe ContributorInsightsStatus)
-> Parser (Maybe Text -> Maybe Text -> ContributorInsightsSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ContributorInsightsStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ContributorInsightsStatus")
            Parser (Maybe Text -> Maybe Text -> ContributorInsightsSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ContributorInsightsSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TableName")
            Parser (Maybe Text -> ContributorInsightsSummary)
-> Parser (Maybe Text) -> Parser ContributorInsightsSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexName")
      )

instance Prelude.Hashable ContributorInsightsSummary

instance Prelude.NFData ContributorInsightsSummary