{-# 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.QuickSight.Types.Sheet
-- 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.QuickSight.Types.Sheet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A /sheet/, which is an object that contains a set of visuals that are
-- viewed together on one page in Amazon QuickSight. Every analysis and
-- dashboard contains at least one sheet. Each sheet contains at least one
-- visualization widget, for example a chart, pivot table, or narrative
-- insight. Sheets can be associated with other components, such as
-- controls, filters, and so on.
--
-- /See:/ 'newSheet' smart constructor.
data Sheet = Sheet'
  { -- | The name of a sheet. This name is displayed on the sheet\'s tab in the
    -- Amazon QuickSight console.
    Sheet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier associated with a sheet.
    Sheet -> Maybe Text
sheetId :: Prelude.Maybe Prelude.Text
  }
  deriving (Sheet -> Sheet -> Bool
(Sheet -> Sheet -> Bool) -> (Sheet -> Sheet -> Bool) -> Eq Sheet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sheet -> Sheet -> Bool
$c/= :: Sheet -> Sheet -> Bool
== :: Sheet -> Sheet -> Bool
$c== :: Sheet -> Sheet -> Bool
Prelude.Eq, ReadPrec [Sheet]
ReadPrec Sheet
Int -> ReadS Sheet
ReadS [Sheet]
(Int -> ReadS Sheet)
-> ReadS [Sheet]
-> ReadPrec Sheet
-> ReadPrec [Sheet]
-> Read Sheet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sheet]
$creadListPrec :: ReadPrec [Sheet]
readPrec :: ReadPrec Sheet
$creadPrec :: ReadPrec Sheet
readList :: ReadS [Sheet]
$creadList :: ReadS [Sheet]
readsPrec :: Int -> ReadS Sheet
$creadsPrec :: Int -> ReadS Sheet
Prelude.Read, Int -> Sheet -> ShowS
[Sheet] -> ShowS
Sheet -> String
(Int -> Sheet -> ShowS)
-> (Sheet -> String) -> ([Sheet] -> ShowS) -> Show Sheet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sheet] -> ShowS
$cshowList :: [Sheet] -> ShowS
show :: Sheet -> String
$cshow :: Sheet -> String
showsPrec :: Int -> Sheet -> ShowS
$cshowsPrec :: Int -> Sheet -> ShowS
Prelude.Show, (forall x. Sheet -> Rep Sheet x)
-> (forall x. Rep Sheet x -> Sheet) -> Generic Sheet
forall x. Rep Sheet x -> Sheet
forall x. Sheet -> Rep Sheet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Sheet x -> Sheet
$cfrom :: forall x. Sheet -> Rep Sheet x
Prelude.Generic)

-- |
-- Create a value of 'Sheet' 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:
--
-- 'name', 'sheet_name' - The name of a sheet. This name is displayed on the sheet\'s tab in the
-- Amazon QuickSight console.
--
-- 'sheetId', 'sheet_sheetId' - The unique identifier associated with a sheet.
newSheet ::
  Sheet
newSheet :: Sheet
newSheet =
  Sheet' :: Maybe Text -> Maybe Text -> Sheet
Sheet'
    { $sel:name:Sheet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sheetId:Sheet' :: Maybe Text
sheetId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of a sheet. This name is displayed on the sheet\'s tab in the
-- Amazon QuickSight console.
sheet_name :: Lens.Lens' Sheet (Prelude.Maybe Prelude.Text)
sheet_name :: (Maybe Text -> f (Maybe Text)) -> Sheet -> f Sheet
sheet_name = (Sheet -> Maybe Text)
-> (Sheet -> Maybe Text -> Sheet)
-> Lens Sheet Sheet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sheet' {Maybe Text
name :: Maybe Text
$sel:name:Sheet' :: Sheet -> Maybe Text
name} -> Maybe Text
name) (\s :: Sheet
s@Sheet' {} Maybe Text
a -> Sheet
s {$sel:name:Sheet' :: Maybe Text
name = Maybe Text
a} :: Sheet)

-- | The unique identifier associated with a sheet.
sheet_sheetId :: Lens.Lens' Sheet (Prelude.Maybe Prelude.Text)
sheet_sheetId :: (Maybe Text -> f (Maybe Text)) -> Sheet -> f Sheet
sheet_sheetId = (Sheet -> Maybe Text)
-> (Sheet -> Maybe Text -> Sheet)
-> Lens Sheet Sheet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sheet' {Maybe Text
sheetId :: Maybe Text
$sel:sheetId:Sheet' :: Sheet -> Maybe Text
sheetId} -> Maybe Text
sheetId) (\s :: Sheet
s@Sheet' {} Maybe Text
a -> Sheet
s {$sel:sheetId:Sheet' :: Maybe Text
sheetId = Maybe Text
a} :: Sheet)

instance Core.FromJSON Sheet where
  parseJSON :: Value -> Parser Sheet
parseJSON =
    String -> (Object -> Parser Sheet) -> Value -> Parser Sheet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Sheet"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Sheet
Sheet'
            (Maybe Text -> Maybe Text -> Sheet)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Sheet)
forall (f :: * -> *) a b. Functor 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
"Name")
            Parser (Maybe Text -> Sheet) -> Parser (Maybe Text) -> Parser Sheet
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
"SheetId")
      )

instance Prelude.Hashable Sheet

instance Prelude.NFData Sheet