{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.ThemeError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.ThemeErrorType

-- | Theme error.
--
-- /See:/ 'newThemeError' smart constructor.
data ThemeError = ThemeError'
  { -- | The type of error.
    ThemeError -> Maybe ThemeErrorType
type' :: Prelude.Maybe ThemeErrorType,
    -- | The error message.
    ThemeError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (ThemeError -> ThemeError -> Bool
(ThemeError -> ThemeError -> Bool)
-> (ThemeError -> ThemeError -> Bool) -> Eq ThemeError
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]
(Int -> ReadS ThemeError)
-> ReadS [ThemeError]
-> ReadPrec ThemeError
-> ReadPrec [ThemeError]
-> Read 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
(Int -> ThemeError -> ShowS)
-> (ThemeError -> String)
-> ([ThemeError] -> ShowS)
-> Show ThemeError
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. ThemeError -> Rep ThemeError x)
-> (forall x. Rep ThemeError x -> ThemeError) -> Generic ThemeError
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:
--
-- 'type'', 'themeError_type' - The type of error.
--
-- 'message', 'themeError_message' - The error message.
newThemeError ::
  ThemeError
newThemeError :: ThemeError
newThemeError =
  ThemeError' :: Maybe ThemeErrorType -> Maybe Text -> ThemeError
ThemeError'
    { $sel:type':ThemeError' :: Maybe ThemeErrorType
type' = Maybe ThemeErrorType
forall a. Maybe a
Prelude.Nothing,
      $sel:message:ThemeError' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of error.
themeError_type :: Lens.Lens' ThemeError (Prelude.Maybe ThemeErrorType)
themeError_type :: (Maybe ThemeErrorType -> f (Maybe ThemeErrorType))
-> ThemeError -> f ThemeError
themeError_type = (ThemeError -> Maybe ThemeErrorType)
-> (ThemeError -> Maybe ThemeErrorType -> ThemeError)
-> Lens
     ThemeError ThemeError (Maybe ThemeErrorType) (Maybe ThemeErrorType)
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)

-- | The error message.
themeError_message :: Lens.Lens' ThemeError (Prelude.Maybe Prelude.Text)
themeError_message :: (Maybe Text -> f (Maybe Text)) -> ThemeError -> f ThemeError
themeError_message = (ThemeError -> Maybe Text)
-> (ThemeError -> Maybe Text -> ThemeError)
-> Lens ThemeError ThemeError (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON ThemeError where
  parseJSON :: Value -> Parser ThemeError
parseJSON =
    String
-> (Object -> Parser ThemeError) -> Value -> Parser ThemeError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ThemeError"
      ( \Object
x ->
          Maybe ThemeErrorType -> Maybe Text -> ThemeError
ThemeError'
            (Maybe ThemeErrorType -> Maybe Text -> ThemeError)
-> Parser (Maybe ThemeErrorType)
-> Parser (Maybe Text -> ThemeError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ThemeErrorType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> ThemeError)
-> Parser (Maybe Text) -> Parser ThemeError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Message")
      )

instance Prelude.Hashable ThemeError

instance Prelude.NFData ThemeError