{-# 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.AppFlow.Types.ConnectorEntity
-- 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.AppFlow.Types.ConnectorEntity 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

-- | The high-level entity that can be queried in Amazon AppFlow. For
-- example, a Salesforce entity might be an /Account/ or /Opportunity/,
-- whereas a ServiceNow entity might be an /Incident/.
--
-- /See:/ 'newConnectorEntity' smart constructor.
data ConnectorEntity = ConnectorEntity'
  { -- | Specifies whether the connector entity is a parent or a category and has
    -- more entities nested underneath it. If another call is made with
    -- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
    -- then it returns the nested entities underneath it. This provides a way
    -- to retrieve all supported entities in a recursive fashion.
    ConnectorEntity -> Maybe Bool
hasNestedEntities :: Prelude.Maybe Prelude.Bool,
    -- | The label applied to the connector entity.
    ConnectorEntity -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The name of the connector entity.
    ConnectorEntity -> Text
name :: Prelude.Text
  }
  deriving (ConnectorEntity -> ConnectorEntity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectorEntity -> ConnectorEntity -> Bool
$c/= :: ConnectorEntity -> ConnectorEntity -> Bool
== :: ConnectorEntity -> ConnectorEntity -> Bool
$c== :: ConnectorEntity -> ConnectorEntity -> Bool
Prelude.Eq, ReadPrec [ConnectorEntity]
ReadPrec ConnectorEntity
Int -> ReadS ConnectorEntity
ReadS [ConnectorEntity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectorEntity]
$creadListPrec :: ReadPrec [ConnectorEntity]
readPrec :: ReadPrec ConnectorEntity
$creadPrec :: ReadPrec ConnectorEntity
readList :: ReadS [ConnectorEntity]
$creadList :: ReadS [ConnectorEntity]
readsPrec :: Int -> ReadS ConnectorEntity
$creadsPrec :: Int -> ReadS ConnectorEntity
Prelude.Read, Int -> ConnectorEntity -> ShowS
[ConnectorEntity] -> ShowS
ConnectorEntity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectorEntity] -> ShowS
$cshowList :: [ConnectorEntity] -> ShowS
show :: ConnectorEntity -> String
$cshow :: ConnectorEntity -> String
showsPrec :: Int -> ConnectorEntity -> ShowS
$cshowsPrec :: Int -> ConnectorEntity -> ShowS
Prelude.Show, forall x. Rep ConnectorEntity x -> ConnectorEntity
forall x. ConnectorEntity -> Rep ConnectorEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectorEntity x -> ConnectorEntity
$cfrom :: forall x. ConnectorEntity -> Rep ConnectorEntity x
Prelude.Generic)

-- |
-- Create a value of 'ConnectorEntity' 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:
--
-- 'hasNestedEntities', 'connectorEntity_hasNestedEntities' - Specifies whether the connector entity is a parent or a category and has
-- more entities nested underneath it. If another call is made with
-- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
-- then it returns the nested entities underneath it. This provides a way
-- to retrieve all supported entities in a recursive fashion.
--
-- 'label', 'connectorEntity_label' - The label applied to the connector entity.
--
-- 'name', 'connectorEntity_name' - The name of the connector entity.
newConnectorEntity ::
  -- | 'name'
  Prelude.Text ->
  ConnectorEntity
newConnectorEntity :: Text -> ConnectorEntity
newConnectorEntity Text
pName_ =
  ConnectorEntity'
    { $sel:hasNestedEntities:ConnectorEntity' :: Maybe Bool
hasNestedEntities =
        forall a. Maybe a
Prelude.Nothing,
      $sel:label:ConnectorEntity' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ConnectorEntity' :: Text
name = Text
pName_
    }

-- | Specifies whether the connector entity is a parent or a category and has
-- more entities nested underneath it. If another call is made with
-- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
-- then it returns the nested entities underneath it. This provides a way
-- to retrieve all supported entities in a recursive fashion.
connectorEntity_hasNestedEntities :: Lens.Lens' ConnectorEntity (Prelude.Maybe Prelude.Bool)
connectorEntity_hasNestedEntities :: Lens' ConnectorEntity (Maybe Bool)
connectorEntity_hasNestedEntities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Maybe Bool
hasNestedEntities :: Maybe Bool
$sel:hasNestedEntities:ConnectorEntity' :: ConnectorEntity -> Maybe Bool
hasNestedEntities} -> Maybe Bool
hasNestedEntities) (\s :: ConnectorEntity
s@ConnectorEntity' {} Maybe Bool
a -> ConnectorEntity
s {$sel:hasNestedEntities:ConnectorEntity' :: Maybe Bool
hasNestedEntities = Maybe Bool
a} :: ConnectorEntity)

-- | The label applied to the connector entity.
connectorEntity_label :: Lens.Lens' ConnectorEntity (Prelude.Maybe Prelude.Text)
connectorEntity_label :: Lens' ConnectorEntity (Maybe Text)
connectorEntity_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Maybe Text
label :: Maybe Text
$sel:label:ConnectorEntity' :: ConnectorEntity -> Maybe Text
label} -> Maybe Text
label) (\s :: ConnectorEntity
s@ConnectorEntity' {} Maybe Text
a -> ConnectorEntity
s {$sel:label:ConnectorEntity' :: Maybe Text
label = Maybe Text
a} :: ConnectorEntity)

-- | The name of the connector entity.
connectorEntity_name :: Lens.Lens' ConnectorEntity Prelude.Text
connectorEntity_name :: Lens' ConnectorEntity Text
connectorEntity_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Text
name :: Text
$sel:name:ConnectorEntity' :: ConnectorEntity -> Text
name} -> Text
name) (\s :: ConnectorEntity
s@ConnectorEntity' {} Text
a -> ConnectorEntity
s {$sel:name:ConnectorEntity' :: Text
name = Text
a} :: ConnectorEntity)

instance Data.FromJSON ConnectorEntity where
  parseJSON :: Value -> Parser ConnectorEntity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectorEntity"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Text -> ConnectorEntity
ConnectorEntity'
            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
"hasNestedEntities")
            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
"label")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
      )

instance Prelude.Hashable ConnectorEntity where
  hashWithSalt :: Int -> ConnectorEntity -> Int
hashWithSalt Int
_salt ConnectorEntity' {Maybe Bool
Maybe Text
Text
name :: Text
label :: Maybe Text
hasNestedEntities :: Maybe Bool
$sel:name:ConnectorEntity' :: ConnectorEntity -> Text
$sel:label:ConnectorEntity' :: ConnectorEntity -> Maybe Text
$sel:hasNestedEntities:ConnectorEntity' :: ConnectorEntity -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasNestedEntities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData ConnectorEntity where
  rnf :: ConnectorEntity -> ()
rnf ConnectorEntity' {Maybe Bool
Maybe Text
Text
name :: Text
label :: Maybe Text
hasNestedEntities :: Maybe Bool
$sel:name:ConnectorEntity' :: ConnectorEntity -> Text
$sel:label:ConnectorEntity' :: ConnectorEntity -> Maybe Text
$sel:hasNestedEntities:ConnectorEntity' :: ConnectorEntity -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasNestedEntities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name