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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:name:Sheet' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:sheetId:Sheet' :: Maybe Text
sheetId = 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 :: Lens' Sheet (Maybe Text)
sheet_name = 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 :: Lens' Sheet (Maybe Text)
sheet_sheetId = 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 Data.FromJSON Sheet where
  parseJSON :: Value -> Parser Sheet
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Sheet"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Sheet
Sheet'
            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
"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
"SheetId")
      )

instance Prelude.Hashable Sheet where
  hashWithSalt :: Int -> Sheet -> Int
hashWithSalt Int
_salt Sheet' {Maybe Text
sheetId :: Maybe Text
name :: Maybe Text
$sel:sheetId:Sheet' :: Sheet -> Maybe Text
$sel:name:Sheet' :: Sheet -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sheetId

instance Prelude.NFData Sheet where
  rnf :: Sheet -> ()
rnf Sheet' {Maybe Text
sheetId :: Maybe Text
name :: Maybe Text
$sel:sheetId:Sheet' :: Sheet -> Maybe Text
$sel:name:Sheet' :: Sheet -> Maybe Text
..} =
    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 Text
sheetId