{-# 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.SheetVisualScopingConfiguration
-- 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.SheetVisualScopingConfiguration 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
import Amazonka.QuickSight.Types.FilterVisualScope

-- | The filter that is applied to the options.
--
-- /See:/ 'newSheetVisualScopingConfiguration' smart constructor.
data SheetVisualScopingConfiguration = SheetVisualScopingConfiguration'
  { -- | The selected visuals that the filter is applied to.
    SheetVisualScopingConfiguration -> Maybe [Text]
visualIds :: Prelude.Maybe [Prelude.Text],
    -- | The selected sheet that the filter is applied to.
    SheetVisualScopingConfiguration -> Text
sheetId :: Prelude.Text,
    -- | The scope of the applied entities. Choose one of the following options:
    --
    -- -   @ALL_VISUALS@
    --
    -- -   @SELECTED_VISUALS@
    SheetVisualScopingConfiguration -> FilterVisualScope
scope :: FilterVisualScope
  }
  deriving (SheetVisualScopingConfiguration
-> SheetVisualScopingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SheetVisualScopingConfiguration
-> SheetVisualScopingConfiguration -> Bool
$c/= :: SheetVisualScopingConfiguration
-> SheetVisualScopingConfiguration -> Bool
== :: SheetVisualScopingConfiguration
-> SheetVisualScopingConfiguration -> Bool
$c== :: SheetVisualScopingConfiguration
-> SheetVisualScopingConfiguration -> Bool
Prelude.Eq, ReadPrec [SheetVisualScopingConfiguration]
ReadPrec SheetVisualScopingConfiguration
Int -> ReadS SheetVisualScopingConfiguration
ReadS [SheetVisualScopingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SheetVisualScopingConfiguration]
$creadListPrec :: ReadPrec [SheetVisualScopingConfiguration]
readPrec :: ReadPrec SheetVisualScopingConfiguration
$creadPrec :: ReadPrec SheetVisualScopingConfiguration
readList :: ReadS [SheetVisualScopingConfiguration]
$creadList :: ReadS [SheetVisualScopingConfiguration]
readsPrec :: Int -> ReadS SheetVisualScopingConfiguration
$creadsPrec :: Int -> ReadS SheetVisualScopingConfiguration
Prelude.Read, Int -> SheetVisualScopingConfiguration -> ShowS
[SheetVisualScopingConfiguration] -> ShowS
SheetVisualScopingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SheetVisualScopingConfiguration] -> ShowS
$cshowList :: [SheetVisualScopingConfiguration] -> ShowS
show :: SheetVisualScopingConfiguration -> String
$cshow :: SheetVisualScopingConfiguration -> String
showsPrec :: Int -> SheetVisualScopingConfiguration -> ShowS
$cshowsPrec :: Int -> SheetVisualScopingConfiguration -> ShowS
Prelude.Show, forall x.
Rep SheetVisualScopingConfiguration x
-> SheetVisualScopingConfiguration
forall x.
SheetVisualScopingConfiguration
-> Rep SheetVisualScopingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SheetVisualScopingConfiguration x
-> SheetVisualScopingConfiguration
$cfrom :: forall x.
SheetVisualScopingConfiguration
-> Rep SheetVisualScopingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SheetVisualScopingConfiguration' 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:
--
-- 'visualIds', 'sheetVisualScopingConfiguration_visualIds' - The selected visuals that the filter is applied to.
--
-- 'sheetId', 'sheetVisualScopingConfiguration_sheetId' - The selected sheet that the filter is applied to.
--
-- 'scope', 'sheetVisualScopingConfiguration_scope' - The scope of the applied entities. Choose one of the following options:
--
-- -   @ALL_VISUALS@
--
-- -   @SELECTED_VISUALS@
newSheetVisualScopingConfiguration ::
  -- | 'sheetId'
  Prelude.Text ->
  -- | 'scope'
  FilterVisualScope ->
  SheetVisualScopingConfiguration
newSheetVisualScopingConfiguration :: Text -> FilterVisualScope -> SheetVisualScopingConfiguration
newSheetVisualScopingConfiguration Text
pSheetId_ FilterVisualScope
pScope_ =
  SheetVisualScopingConfiguration'
    { $sel:visualIds:SheetVisualScopingConfiguration' :: Maybe [Text]
visualIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sheetId:SheetVisualScopingConfiguration' :: Text
sheetId = Text
pSheetId_,
      $sel:scope:SheetVisualScopingConfiguration' :: FilterVisualScope
scope = FilterVisualScope
pScope_
    }

-- | The selected visuals that the filter is applied to.
sheetVisualScopingConfiguration_visualIds :: Lens.Lens' SheetVisualScopingConfiguration (Prelude.Maybe [Prelude.Text])
sheetVisualScopingConfiguration_visualIds :: Lens' SheetVisualScopingConfiguration (Maybe [Text])
sheetVisualScopingConfiguration_visualIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetVisualScopingConfiguration' {Maybe [Text]
visualIds :: Maybe [Text]
$sel:visualIds:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Maybe [Text]
visualIds} -> Maybe [Text]
visualIds) (\s :: SheetVisualScopingConfiguration
s@SheetVisualScopingConfiguration' {} Maybe [Text]
a -> SheetVisualScopingConfiguration
s {$sel:visualIds:SheetVisualScopingConfiguration' :: Maybe [Text]
visualIds = Maybe [Text]
a} :: SheetVisualScopingConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The selected sheet that the filter is applied to.
sheetVisualScopingConfiguration_sheetId :: Lens.Lens' SheetVisualScopingConfiguration Prelude.Text
sheetVisualScopingConfiguration_sheetId :: Lens' SheetVisualScopingConfiguration Text
sheetVisualScopingConfiguration_sheetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetVisualScopingConfiguration' {Text
sheetId :: Text
$sel:sheetId:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Text
sheetId} -> Text
sheetId) (\s :: SheetVisualScopingConfiguration
s@SheetVisualScopingConfiguration' {} Text
a -> SheetVisualScopingConfiguration
s {$sel:sheetId:SheetVisualScopingConfiguration' :: Text
sheetId = Text
a} :: SheetVisualScopingConfiguration)

-- | The scope of the applied entities. Choose one of the following options:
--
-- -   @ALL_VISUALS@
--
-- -   @SELECTED_VISUALS@
sheetVisualScopingConfiguration_scope :: Lens.Lens' SheetVisualScopingConfiguration FilterVisualScope
sheetVisualScopingConfiguration_scope :: Lens' SheetVisualScopingConfiguration FilterVisualScope
sheetVisualScopingConfiguration_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SheetVisualScopingConfiguration' {FilterVisualScope
scope :: FilterVisualScope
$sel:scope:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> FilterVisualScope
scope} -> FilterVisualScope
scope) (\s :: SheetVisualScopingConfiguration
s@SheetVisualScopingConfiguration' {} FilterVisualScope
a -> SheetVisualScopingConfiguration
s {$sel:scope:SheetVisualScopingConfiguration' :: FilterVisualScope
scope = FilterVisualScope
a} :: SheetVisualScopingConfiguration)

instance
  Data.FromJSON
    SheetVisualScopingConfiguration
  where
  parseJSON :: Value -> Parser SheetVisualScopingConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SheetVisualScopingConfiguration"
      ( \Object
x ->
          Maybe [Text]
-> Text -> FilterVisualScope -> SheetVisualScopingConfiguration
SheetVisualScopingConfiguration'
            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
"VisualIds" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"SheetId")
            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
"Scope")
      )

instance
  Prelude.Hashable
    SheetVisualScopingConfiguration
  where
  hashWithSalt :: Int -> SheetVisualScopingConfiguration -> Int
hashWithSalt
    Int
_salt
    SheetVisualScopingConfiguration' {Maybe [Text]
Text
FilterVisualScope
scope :: FilterVisualScope
sheetId :: Text
visualIds :: Maybe [Text]
$sel:scope:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> FilterVisualScope
$sel:sheetId:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Text
$sel:visualIds:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
visualIds
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sheetId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FilterVisualScope
scope

instance
  Prelude.NFData
    SheetVisualScopingConfiguration
  where
  rnf :: SheetVisualScopingConfiguration -> ()
rnf SheetVisualScopingConfiguration' {Maybe [Text]
Text
FilterVisualScope
scope :: FilterVisualScope
sheetId :: Text
visualIds :: Maybe [Text]
$sel:scope:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> FilterVisualScope
$sel:sheetId:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Text
$sel:visualIds:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
visualIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sheetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FilterVisualScope
scope

instance Data.ToJSON SheetVisualScopingConfiguration where
  toJSON :: SheetVisualScopingConfiguration -> Value
toJSON SheetVisualScopingConfiguration' {Maybe [Text]
Text
FilterVisualScope
scope :: FilterVisualScope
sheetId :: Text
visualIds :: Maybe [Text]
$sel:scope:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> FilterVisualScope
$sel:sheetId:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Text
$sel:visualIds:SheetVisualScopingConfiguration' :: SheetVisualScopingConfiguration -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VisualIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
visualIds,
            forall a. a -> Maybe a
Prelude.Just (Key
"SheetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sheetId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FilterVisualScope
scope)
          ]
      )