{-# 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.TableFieldImageConfiguration
-- 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.TableFieldImageConfiguration 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.TableCellImageSizingConfiguration

-- | The image configuration of a table field URL.
--
-- /See:/ 'newTableFieldImageConfiguration' smart constructor.
data TableFieldImageConfiguration = TableFieldImageConfiguration'
  { -- | The sizing options for the table image configuration.
    TableFieldImageConfiguration
-> Maybe TableCellImageSizingConfiguration
sizingOptions :: Prelude.Maybe TableCellImageSizingConfiguration
  }
  deriving (TableFieldImageConfiguration
-> TableFieldImageConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableFieldImageConfiguration
-> TableFieldImageConfiguration -> Bool
$c/= :: TableFieldImageConfiguration
-> TableFieldImageConfiguration -> Bool
== :: TableFieldImageConfiguration
-> TableFieldImageConfiguration -> Bool
$c== :: TableFieldImageConfiguration
-> TableFieldImageConfiguration -> Bool
Prelude.Eq, ReadPrec [TableFieldImageConfiguration]
ReadPrec TableFieldImageConfiguration
Int -> ReadS TableFieldImageConfiguration
ReadS [TableFieldImageConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableFieldImageConfiguration]
$creadListPrec :: ReadPrec [TableFieldImageConfiguration]
readPrec :: ReadPrec TableFieldImageConfiguration
$creadPrec :: ReadPrec TableFieldImageConfiguration
readList :: ReadS [TableFieldImageConfiguration]
$creadList :: ReadS [TableFieldImageConfiguration]
readsPrec :: Int -> ReadS TableFieldImageConfiguration
$creadsPrec :: Int -> ReadS TableFieldImageConfiguration
Prelude.Read, Int -> TableFieldImageConfiguration -> ShowS
[TableFieldImageConfiguration] -> ShowS
TableFieldImageConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableFieldImageConfiguration] -> ShowS
$cshowList :: [TableFieldImageConfiguration] -> ShowS
show :: TableFieldImageConfiguration -> String
$cshow :: TableFieldImageConfiguration -> String
showsPrec :: Int -> TableFieldImageConfiguration -> ShowS
$cshowsPrec :: Int -> TableFieldImageConfiguration -> ShowS
Prelude.Show, forall x.
Rep TableFieldImageConfiguration x -> TableFieldImageConfiguration
forall x.
TableFieldImageConfiguration -> Rep TableFieldImageConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TableFieldImageConfiguration x -> TableFieldImageConfiguration
$cfrom :: forall x.
TableFieldImageConfiguration -> Rep TableFieldImageConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TableFieldImageConfiguration' 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:
--
-- 'sizingOptions', 'tableFieldImageConfiguration_sizingOptions' - The sizing options for the table image configuration.
newTableFieldImageConfiguration ::
  TableFieldImageConfiguration
newTableFieldImageConfiguration :: TableFieldImageConfiguration
newTableFieldImageConfiguration =
  TableFieldImageConfiguration'
    { $sel:sizingOptions:TableFieldImageConfiguration' :: Maybe TableCellImageSizingConfiguration
sizingOptions =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The sizing options for the table image configuration.
tableFieldImageConfiguration_sizingOptions :: Lens.Lens' TableFieldImageConfiguration (Prelude.Maybe TableCellImageSizingConfiguration)
tableFieldImageConfiguration_sizingOptions :: Lens'
  TableFieldImageConfiguration
  (Maybe TableCellImageSizingConfiguration)
tableFieldImageConfiguration_sizingOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableFieldImageConfiguration' {Maybe TableCellImageSizingConfiguration
sizingOptions :: Maybe TableCellImageSizingConfiguration
$sel:sizingOptions:TableFieldImageConfiguration' :: TableFieldImageConfiguration
-> Maybe TableCellImageSizingConfiguration
sizingOptions} -> Maybe TableCellImageSizingConfiguration
sizingOptions) (\s :: TableFieldImageConfiguration
s@TableFieldImageConfiguration' {} Maybe TableCellImageSizingConfiguration
a -> TableFieldImageConfiguration
s {$sel:sizingOptions:TableFieldImageConfiguration' :: Maybe TableCellImageSizingConfiguration
sizingOptions = Maybe TableCellImageSizingConfiguration
a} :: TableFieldImageConfiguration)

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

instance
  Prelude.Hashable
    TableFieldImageConfiguration
  where
  hashWithSalt :: Int -> TableFieldImageConfiguration -> Int
hashWithSalt Int
_salt TableFieldImageConfiguration' {Maybe TableCellImageSizingConfiguration
sizingOptions :: Maybe TableCellImageSizingConfiguration
$sel:sizingOptions:TableFieldImageConfiguration' :: TableFieldImageConfiguration
-> Maybe TableCellImageSizingConfiguration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableCellImageSizingConfiguration
sizingOptions

instance Prelude.NFData TableFieldImageConfiguration where
  rnf :: TableFieldImageConfiguration -> ()
rnf TableFieldImageConfiguration' {Maybe TableCellImageSizingConfiguration
sizingOptions :: Maybe TableCellImageSizingConfiguration
$sel:sizingOptions:TableFieldImageConfiguration' :: TableFieldImageConfiguration
-> Maybe TableCellImageSizingConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TableCellImageSizingConfiguration
sizingOptions

instance Data.ToJSON TableFieldImageConfiguration where
  toJSON :: TableFieldImageConfiguration -> Value
toJSON TableFieldImageConfiguration' {Maybe TableCellImageSizingConfiguration
sizingOptions :: Maybe TableCellImageSizingConfiguration
$sel:sizingOptions:TableFieldImageConfiguration' :: TableFieldImageConfiguration
-> Maybe TableCellImageSizingConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SizingOptions" 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 TableCellImageSizingConfiguration
sizingOptions
          ]
      )