{-# 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.LoadingAnimation
-- 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.LoadingAnimation 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.Visibility

-- | The configuration of loading animation in free-form layout.
--
-- /See:/ 'newLoadingAnimation' smart constructor.
data LoadingAnimation = LoadingAnimation'
  { -- | The visibility configuration of @LoadingAnimation@.
    LoadingAnimation -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (LoadingAnimation -> LoadingAnimation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoadingAnimation -> LoadingAnimation -> Bool
$c/= :: LoadingAnimation -> LoadingAnimation -> Bool
== :: LoadingAnimation -> LoadingAnimation -> Bool
$c== :: LoadingAnimation -> LoadingAnimation -> Bool
Prelude.Eq, ReadPrec [LoadingAnimation]
ReadPrec LoadingAnimation
Int -> ReadS LoadingAnimation
ReadS [LoadingAnimation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoadingAnimation]
$creadListPrec :: ReadPrec [LoadingAnimation]
readPrec :: ReadPrec LoadingAnimation
$creadPrec :: ReadPrec LoadingAnimation
readList :: ReadS [LoadingAnimation]
$creadList :: ReadS [LoadingAnimation]
readsPrec :: Int -> ReadS LoadingAnimation
$creadsPrec :: Int -> ReadS LoadingAnimation
Prelude.Read, Int -> LoadingAnimation -> ShowS
[LoadingAnimation] -> ShowS
LoadingAnimation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoadingAnimation] -> ShowS
$cshowList :: [LoadingAnimation] -> ShowS
show :: LoadingAnimation -> String
$cshow :: LoadingAnimation -> String
showsPrec :: Int -> LoadingAnimation -> ShowS
$cshowsPrec :: Int -> LoadingAnimation -> ShowS
Prelude.Show, forall x. Rep LoadingAnimation x -> LoadingAnimation
forall x. LoadingAnimation -> Rep LoadingAnimation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoadingAnimation x -> LoadingAnimation
$cfrom :: forall x. LoadingAnimation -> Rep LoadingAnimation x
Prelude.Generic)

-- |
-- Create a value of 'LoadingAnimation' 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:
--
-- 'visibility', 'loadingAnimation_visibility' - The visibility configuration of @LoadingAnimation@.
newLoadingAnimation ::
  LoadingAnimation
newLoadingAnimation :: LoadingAnimation
newLoadingAnimation =
  LoadingAnimation' {$sel:visibility:LoadingAnimation' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing}

-- | The visibility configuration of @LoadingAnimation@.
loadingAnimation_visibility :: Lens.Lens' LoadingAnimation (Prelude.Maybe Visibility)
loadingAnimation_visibility :: Lens' LoadingAnimation (Maybe Visibility)
loadingAnimation_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadingAnimation' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:LoadingAnimation' :: LoadingAnimation -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: LoadingAnimation
s@LoadingAnimation' {} Maybe Visibility
a -> LoadingAnimation
s {$sel:visibility:LoadingAnimation' :: Maybe Visibility
visibility = Maybe Visibility
a} :: LoadingAnimation)

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

instance Prelude.Hashable LoadingAnimation where
  hashWithSalt :: Int -> LoadingAnimation -> Int
hashWithSalt Int
_salt LoadingAnimation' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:LoadingAnimation' :: LoadingAnimation -> Maybe Visibility
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance Prelude.NFData LoadingAnimation where
  rnf :: LoadingAnimation -> ()
rnf LoadingAnimation' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:LoadingAnimation' :: LoadingAnimation -> Maybe Visibility
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

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