{-# 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.GridLayoutScreenCanvasSizeOptions
-- 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.GridLayoutScreenCanvasSizeOptions 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.ResizeOption

-- | The options that determine the sizing of the canvas used in a grid
-- layout.
--
-- /See:/ 'newGridLayoutScreenCanvasSizeOptions' smart constructor.
data GridLayoutScreenCanvasSizeOptions = GridLayoutScreenCanvasSizeOptions'
  { -- | The width that the view port will be optimized for when the layout
    -- renders.
    GridLayoutScreenCanvasSizeOptions -> Maybe Text
optimizedViewPortWidth :: Prelude.Maybe Prelude.Text,
    -- | This value determines the layout behavior when the viewport is resized.
    --
    -- -   @FIXED@: A fixed width will be used when optimizing the layout. In
    --     the Amazon QuickSight console, this option is called @Classic@.
    --
    -- -   @RESPONSIVE@: The width of the canvas will be responsive and
    --     optimized to the view port. In the Amazon QuickSight console, this
    --     option is called @Tiled@.
    GridLayoutScreenCanvasSizeOptions -> ResizeOption
resizeOption :: ResizeOption
  }
  deriving (GridLayoutScreenCanvasSizeOptions
-> GridLayoutScreenCanvasSizeOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GridLayoutScreenCanvasSizeOptions
-> GridLayoutScreenCanvasSizeOptions -> Bool
$c/= :: GridLayoutScreenCanvasSizeOptions
-> GridLayoutScreenCanvasSizeOptions -> Bool
== :: GridLayoutScreenCanvasSizeOptions
-> GridLayoutScreenCanvasSizeOptions -> Bool
$c== :: GridLayoutScreenCanvasSizeOptions
-> GridLayoutScreenCanvasSizeOptions -> Bool
Prelude.Eq, ReadPrec [GridLayoutScreenCanvasSizeOptions]
ReadPrec GridLayoutScreenCanvasSizeOptions
Int -> ReadS GridLayoutScreenCanvasSizeOptions
ReadS [GridLayoutScreenCanvasSizeOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GridLayoutScreenCanvasSizeOptions]
$creadListPrec :: ReadPrec [GridLayoutScreenCanvasSizeOptions]
readPrec :: ReadPrec GridLayoutScreenCanvasSizeOptions
$creadPrec :: ReadPrec GridLayoutScreenCanvasSizeOptions
readList :: ReadS [GridLayoutScreenCanvasSizeOptions]
$creadList :: ReadS [GridLayoutScreenCanvasSizeOptions]
readsPrec :: Int -> ReadS GridLayoutScreenCanvasSizeOptions
$creadsPrec :: Int -> ReadS GridLayoutScreenCanvasSizeOptions
Prelude.Read, Int -> GridLayoutScreenCanvasSizeOptions -> ShowS
[GridLayoutScreenCanvasSizeOptions] -> ShowS
GridLayoutScreenCanvasSizeOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GridLayoutScreenCanvasSizeOptions] -> ShowS
$cshowList :: [GridLayoutScreenCanvasSizeOptions] -> ShowS
show :: GridLayoutScreenCanvasSizeOptions -> String
$cshow :: GridLayoutScreenCanvasSizeOptions -> String
showsPrec :: Int -> GridLayoutScreenCanvasSizeOptions -> ShowS
$cshowsPrec :: Int -> GridLayoutScreenCanvasSizeOptions -> ShowS
Prelude.Show, forall x.
Rep GridLayoutScreenCanvasSizeOptions x
-> GridLayoutScreenCanvasSizeOptions
forall x.
GridLayoutScreenCanvasSizeOptions
-> Rep GridLayoutScreenCanvasSizeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GridLayoutScreenCanvasSizeOptions x
-> GridLayoutScreenCanvasSizeOptions
$cfrom :: forall x.
GridLayoutScreenCanvasSizeOptions
-> Rep GridLayoutScreenCanvasSizeOptions x
Prelude.Generic)

-- |
-- Create a value of 'GridLayoutScreenCanvasSizeOptions' 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:
--
-- 'optimizedViewPortWidth', 'gridLayoutScreenCanvasSizeOptions_optimizedViewPortWidth' - The width that the view port will be optimized for when the layout
-- renders.
--
-- 'resizeOption', 'gridLayoutScreenCanvasSizeOptions_resizeOption' - This value determines the layout behavior when the viewport is resized.
--
-- -   @FIXED@: A fixed width will be used when optimizing the layout. In
--     the Amazon QuickSight console, this option is called @Classic@.
--
-- -   @RESPONSIVE@: The width of the canvas will be responsive and
--     optimized to the view port. In the Amazon QuickSight console, this
--     option is called @Tiled@.
newGridLayoutScreenCanvasSizeOptions ::
  -- | 'resizeOption'
  ResizeOption ->
  GridLayoutScreenCanvasSizeOptions
newGridLayoutScreenCanvasSizeOptions :: ResizeOption -> GridLayoutScreenCanvasSizeOptions
newGridLayoutScreenCanvasSizeOptions ResizeOption
pResizeOption_ =
  GridLayoutScreenCanvasSizeOptions'
    { $sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: Maybe Text
optimizedViewPortWidth =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: ResizeOption
resizeOption = ResizeOption
pResizeOption_
    }

-- | The width that the view port will be optimized for when the layout
-- renders.
gridLayoutScreenCanvasSizeOptions_optimizedViewPortWidth :: Lens.Lens' GridLayoutScreenCanvasSizeOptions (Prelude.Maybe Prelude.Text)
gridLayoutScreenCanvasSizeOptions_optimizedViewPortWidth :: Lens' GridLayoutScreenCanvasSizeOptions (Maybe Text)
gridLayoutScreenCanvasSizeOptions_optimizedViewPortWidth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GridLayoutScreenCanvasSizeOptions' {Maybe Text
optimizedViewPortWidth :: Maybe Text
$sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> Maybe Text
optimizedViewPortWidth} -> Maybe Text
optimizedViewPortWidth) (\s :: GridLayoutScreenCanvasSizeOptions
s@GridLayoutScreenCanvasSizeOptions' {} Maybe Text
a -> GridLayoutScreenCanvasSizeOptions
s {$sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: Maybe Text
optimizedViewPortWidth = Maybe Text
a} :: GridLayoutScreenCanvasSizeOptions)

-- | This value determines the layout behavior when the viewport is resized.
--
-- -   @FIXED@: A fixed width will be used when optimizing the layout. In
--     the Amazon QuickSight console, this option is called @Classic@.
--
-- -   @RESPONSIVE@: The width of the canvas will be responsive and
--     optimized to the view port. In the Amazon QuickSight console, this
--     option is called @Tiled@.
gridLayoutScreenCanvasSizeOptions_resizeOption :: Lens.Lens' GridLayoutScreenCanvasSizeOptions ResizeOption
gridLayoutScreenCanvasSizeOptions_resizeOption :: Lens' GridLayoutScreenCanvasSizeOptions ResizeOption
gridLayoutScreenCanvasSizeOptions_resizeOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GridLayoutScreenCanvasSizeOptions' {ResizeOption
resizeOption :: ResizeOption
$sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> ResizeOption
resizeOption} -> ResizeOption
resizeOption) (\s :: GridLayoutScreenCanvasSizeOptions
s@GridLayoutScreenCanvasSizeOptions' {} ResizeOption
a -> GridLayoutScreenCanvasSizeOptions
s {$sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: ResizeOption
resizeOption = ResizeOption
a} :: GridLayoutScreenCanvasSizeOptions)

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

instance
  Prelude.Hashable
    GridLayoutScreenCanvasSizeOptions
  where
  hashWithSalt :: Int -> GridLayoutScreenCanvasSizeOptions -> Int
hashWithSalt
    Int
_salt
    GridLayoutScreenCanvasSizeOptions' {Maybe Text
ResizeOption
resizeOption :: ResizeOption
optimizedViewPortWidth :: Maybe Text
$sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> ResizeOption
$sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
optimizedViewPortWidth
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResizeOption
resizeOption

instance
  Prelude.NFData
    GridLayoutScreenCanvasSizeOptions
  where
  rnf :: GridLayoutScreenCanvasSizeOptions -> ()
rnf GridLayoutScreenCanvasSizeOptions' {Maybe Text
ResizeOption
resizeOption :: ResizeOption
optimizedViewPortWidth :: Maybe Text
$sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> ResizeOption
$sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
optimizedViewPortWidth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResizeOption
resizeOption

instance
  Data.ToJSON
    GridLayoutScreenCanvasSizeOptions
  where
  toJSON :: GridLayoutScreenCanvasSizeOptions -> Value
toJSON GridLayoutScreenCanvasSizeOptions' {Maybe Text
ResizeOption
resizeOption :: ResizeOption
optimizedViewPortWidth :: Maybe Text
$sel:resizeOption:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> ResizeOption
$sel:optimizedViewPortWidth:GridLayoutScreenCanvasSizeOptions' :: GridLayoutScreenCanvasSizeOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"OptimizedViewPortWidth" 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
optimizedViewPortWidth,
            forall a. a -> Maybe a
Prelude.Just (Key
"ResizeOption" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ResizeOption
resizeOption)
          ]
      )