{-# 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.Entity
-- 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.Entity 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

-- | An object, structure, or sub-structure of an analysis, template, or
-- dashboard.
--
-- /See:/ 'newEntity' smart constructor.
data Entity = Entity'
  { -- | The hierarchical path of the entity within the analysis, template, or
    -- dashboard definition tree.
    Entity -> Maybe Text
path :: Prelude.Maybe Prelude.Text
  }
  deriving (Entity -> Entity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Entity -> Entity -> Bool
$c/= :: Entity -> Entity -> Bool
== :: Entity -> Entity -> Bool
$c== :: Entity -> Entity -> Bool
Prelude.Eq, ReadPrec [Entity]
ReadPrec Entity
Int -> ReadS Entity
ReadS [Entity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Entity]
$creadListPrec :: ReadPrec [Entity]
readPrec :: ReadPrec Entity
$creadPrec :: ReadPrec Entity
readList :: ReadS [Entity]
$creadList :: ReadS [Entity]
readsPrec :: Int -> ReadS Entity
$creadsPrec :: Int -> ReadS Entity
Prelude.Read, Int -> Entity -> ShowS
[Entity] -> ShowS
Entity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Entity] -> ShowS
$cshowList :: [Entity] -> ShowS
show :: Entity -> String
$cshow :: Entity -> String
showsPrec :: Int -> Entity -> ShowS
$cshowsPrec :: Int -> Entity -> ShowS
Prelude.Show, forall x. Rep Entity x -> Entity
forall x. Entity -> Rep Entity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Entity x -> Entity
$cfrom :: forall x. Entity -> Rep Entity x
Prelude.Generic)

-- |
-- Create a value of 'Entity' 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:
--
-- 'path', 'entity_path' - The hierarchical path of the entity within the analysis, template, or
-- dashboard definition tree.
newEntity ::
  Entity
newEntity :: Entity
newEntity = Entity' {$sel:path:Entity' :: Maybe Text
path = forall a. Maybe a
Prelude.Nothing}

-- | The hierarchical path of the entity within the analysis, template, or
-- dashboard definition tree.
entity_path :: Lens.Lens' Entity (Prelude.Maybe Prelude.Text)
entity_path :: Lens' Entity (Maybe Text)
entity_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe Text
path :: Maybe Text
$sel:path:Entity' :: Entity -> Maybe Text
path} -> Maybe Text
path) (\s :: Entity
s@Entity' {} Maybe Text
a -> Entity
s {$sel:path:Entity' :: Maybe Text
path = Maybe Text
a} :: Entity)

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

instance Prelude.Hashable Entity where
  hashWithSalt :: Int -> Entity -> Int
hashWithSalt Int
_salt Entity' {Maybe Text
path :: Maybe Text
$sel:path:Entity' :: Entity -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
path

instance Prelude.NFData Entity where
  rnf :: Entity -> ()
rnf Entity' {Maybe Text
path :: Maybe Text
$sel:path:Entity' :: Entity -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
path