{-# 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.ThemeError
-- 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.ThemeError 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.ThemeErrorType

-- | Theme error.
--
-- /See:/ 'newThemeError' smart constructor.
data ThemeError = ThemeError'
  { -- | The error message.
    ThemeError -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The type of error.
    ThemeError -> Maybe ThemeErrorType
type' :: Prelude.Maybe ThemeErrorType
  }
  deriving (ThemeError -> ThemeError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThemeError -> ThemeError -> Bool
$c/= :: ThemeError -> ThemeError -> Bool
== :: ThemeError -> ThemeError -> Bool
$c== :: ThemeError -> ThemeError -> Bool
Prelude.Eq, ReadPrec [ThemeError]
ReadPrec ThemeError
Int -> ReadS ThemeError
ReadS [ThemeError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThemeError]
$creadListPrec :: ReadPrec [ThemeError]
readPrec :: ReadPrec ThemeError
$creadPrec :: ReadPrec ThemeError
readList :: ReadS [ThemeError]
$creadList :: ReadS [ThemeError]
readsPrec :: Int -> ReadS ThemeError
$creadsPrec :: Int -> ReadS ThemeError
Prelude.Read, Int -> ThemeError -> ShowS
[ThemeError] -> ShowS
ThemeError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThemeError] -> ShowS
$cshowList :: [ThemeError] -> ShowS
show :: ThemeError -> String
$cshow :: ThemeError -> String
showsPrec :: Int -> ThemeError -> ShowS
$cshowsPrec :: Int -> ThemeError -> ShowS
Prelude.Show, forall x. Rep ThemeError x -> ThemeError
forall x. ThemeError -> Rep ThemeError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThemeError x -> ThemeError
$cfrom :: forall x. ThemeError -> Rep ThemeError x
Prelude.Generic)

-- |
-- Create a value of 'ThemeError' 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:
--
-- 'message', 'themeError_message' - The error message.
--
-- 'type'', 'themeError_type' - The type of error.
newThemeError ::
  ThemeError
newThemeError :: ThemeError
newThemeError =
  ThemeError'
    { $sel:message:ThemeError' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ThemeError' :: Maybe ThemeErrorType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The error message.
themeError_message :: Lens.Lens' ThemeError (Prelude.Maybe Prelude.Text)
themeError_message :: Lens' ThemeError (Maybe Text)
themeError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThemeError' {Maybe Text
message :: Maybe Text
$sel:message:ThemeError' :: ThemeError -> Maybe Text
message} -> Maybe Text
message) (\s :: ThemeError
s@ThemeError' {} Maybe Text
a -> ThemeError
s {$sel:message:ThemeError' :: Maybe Text
message = Maybe Text
a} :: ThemeError)

-- | The type of error.
themeError_type :: Lens.Lens' ThemeError (Prelude.Maybe ThemeErrorType)
themeError_type :: Lens' ThemeError (Maybe ThemeErrorType)
themeError_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThemeError' {Maybe ThemeErrorType
type' :: Maybe ThemeErrorType
$sel:type':ThemeError' :: ThemeError -> Maybe ThemeErrorType
type'} -> Maybe ThemeErrorType
type') (\s :: ThemeError
s@ThemeError' {} Maybe ThemeErrorType
a -> ThemeError
s {$sel:type':ThemeError' :: Maybe ThemeErrorType
type' = Maybe ThemeErrorType
a} :: ThemeError)

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

instance Prelude.Hashable ThemeError where
  hashWithSalt :: Int -> ThemeError -> Int
hashWithSalt Int
_salt ThemeError' {Maybe Text
Maybe ThemeErrorType
type' :: Maybe ThemeErrorType
message :: Maybe Text
$sel:type':ThemeError' :: ThemeError -> Maybe ThemeErrorType
$sel:message:ThemeError' :: ThemeError -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThemeErrorType
type'

instance Prelude.NFData ThemeError where
  rnf :: ThemeError -> ()
rnf ThemeError' {Maybe Text
Maybe ThemeErrorType
type' :: Maybe ThemeErrorType
message :: Maybe Text
$sel:type':ThemeError' :: ThemeError -> Maybe ThemeErrorType
$sel:message:ThemeError' :: ThemeError -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThemeErrorType
type'