{-# 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.DashboardError
-- 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.DashboardError 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.DashboardErrorType
import Amazonka.QuickSight.Types.Entity

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

-- |
-- Create a value of 'DashboardError' 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', 'dashboardError_message' - Message.
--
-- 'type'', 'dashboardError_type' - Type.
--
-- 'violatedEntities', 'dashboardError_violatedEntities' -
newDashboardError ::
  DashboardError
newDashboardError :: DashboardError
newDashboardError =
  DashboardError'
    { $sel:message:DashboardError' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DashboardError' :: Maybe DashboardErrorType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:violatedEntities:DashboardError' :: Maybe [Entity]
violatedEntities = forall a. Maybe a
Prelude.Nothing
    }

-- | Message.
dashboardError_message :: Lens.Lens' DashboardError (Prelude.Maybe Prelude.Text)
dashboardError_message :: Lens' DashboardError (Maybe Text)
dashboardError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardError' {Maybe Text
message :: Maybe Text
$sel:message:DashboardError' :: DashboardError -> Maybe Text
message} -> Maybe Text
message) (\s :: DashboardError
s@DashboardError' {} Maybe Text
a -> DashboardError
s {$sel:message:DashboardError' :: Maybe Text
message = Maybe Text
a} :: DashboardError)

-- | Type.
dashboardError_type :: Lens.Lens' DashboardError (Prelude.Maybe DashboardErrorType)
dashboardError_type :: Lens' DashboardError (Maybe DashboardErrorType)
dashboardError_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardError' {Maybe DashboardErrorType
type' :: Maybe DashboardErrorType
$sel:type':DashboardError' :: DashboardError -> Maybe DashboardErrorType
type'} -> Maybe DashboardErrorType
type') (\s :: DashboardError
s@DashboardError' {} Maybe DashboardErrorType
a -> DashboardError
s {$sel:type':DashboardError' :: Maybe DashboardErrorType
type' = Maybe DashboardErrorType
a} :: DashboardError)

dashboardError_violatedEntities :: Lens.Lens' DashboardError (Prelude.Maybe [Entity])
dashboardError_violatedEntities :: Lens' DashboardError (Maybe [Entity])
dashboardError_violatedEntities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardError' {Maybe [Entity]
violatedEntities :: Maybe [Entity]
$sel:violatedEntities:DashboardError' :: DashboardError -> Maybe [Entity]
violatedEntities} -> Maybe [Entity]
violatedEntities) (\s :: DashboardError
s@DashboardError' {} Maybe [Entity]
a -> DashboardError
s {$sel:violatedEntities:DashboardError' :: Maybe [Entity]
violatedEntities = Maybe [Entity]
a} :: DashboardError) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON DashboardError where
  parseJSON :: Value -> Parser DashboardError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DashboardError"
      ( \Object
x ->
          Maybe Text
-> Maybe DashboardErrorType -> Maybe [Entity] -> DashboardError
DashboardError'
            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")
            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
"ViolatedEntities"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable DashboardError where
  hashWithSalt :: Int -> DashboardError -> Int
hashWithSalt Int
_salt DashboardError' {Maybe [Entity]
Maybe Text
Maybe DashboardErrorType
violatedEntities :: Maybe [Entity]
type' :: Maybe DashboardErrorType
message :: Maybe Text
$sel:violatedEntities:DashboardError' :: DashboardError -> Maybe [Entity]
$sel:type':DashboardError' :: DashboardError -> Maybe DashboardErrorType
$sel:message:DashboardError' :: DashboardError -> 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 DashboardErrorType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Entity]
violatedEntities

instance Prelude.NFData DashboardError where
  rnf :: DashboardError -> ()
rnf DashboardError' {Maybe [Entity]
Maybe Text
Maybe DashboardErrorType
violatedEntities :: Maybe [Entity]
type' :: Maybe DashboardErrorType
message :: Maybe Text
$sel:violatedEntities:DashboardError' :: DashboardError -> Maybe [Entity]
$sel:type':DashboardError' :: DashboardError -> Maybe DashboardErrorType
$sel:message:DashboardError' :: DashboardError -> 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 DashboardErrorType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Entity]
violatedEntities