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

import Amazonka.AppFlow.Types.DestinationFieldProperties
import Amazonka.AppFlow.Types.SourceFieldProperties
import Amazonka.AppFlow.Types.SupportedFieldTypeDetails
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the data model of a connector field. For example, for an
-- /account/ entity, the fields would be /account name/, /account ID/, and
-- so on.
--
-- /See:/ 'newConnectorEntityField' smart constructor.
data ConnectorEntityField = ConnectorEntityField'
  { -- | The properties that can be applied to a field when the connector is
    -- being used as a source.
    ConnectorEntityField -> Maybe SourceFieldProperties
sourceProperties :: Prelude.Maybe SourceFieldProperties,
    -- | Contains details regarding the supported @FieldType@, including the
    -- corresponding @filterOperators@ and @supportedValues@.
    ConnectorEntityField -> Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails :: Prelude.Maybe SupportedFieldTypeDetails,
    -- | The properties applied to a field when the connector is being used as a
    -- destination.
    ConnectorEntityField -> Maybe DestinationFieldProperties
destinationProperties :: Prelude.Maybe DestinationFieldProperties,
    -- | A description of the connector entity field.
    ConnectorEntityField -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The label applied to a connector entity field.
    ConnectorEntityField -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the connector field.
    ConnectorEntityField -> Text
identifier :: Prelude.Text
  }
  deriving (ConnectorEntityField -> ConnectorEntityField -> Bool
(ConnectorEntityField -> ConnectorEntityField -> Bool)
-> (ConnectorEntityField -> ConnectorEntityField -> Bool)
-> Eq ConnectorEntityField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectorEntityField -> ConnectorEntityField -> Bool
$c/= :: ConnectorEntityField -> ConnectorEntityField -> Bool
== :: ConnectorEntityField -> ConnectorEntityField -> Bool
$c== :: ConnectorEntityField -> ConnectorEntityField -> Bool
Prelude.Eq, ReadPrec [ConnectorEntityField]
ReadPrec ConnectorEntityField
Int -> ReadS ConnectorEntityField
ReadS [ConnectorEntityField]
(Int -> ReadS ConnectorEntityField)
-> ReadS [ConnectorEntityField]
-> ReadPrec ConnectorEntityField
-> ReadPrec [ConnectorEntityField]
-> Read ConnectorEntityField
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectorEntityField]
$creadListPrec :: ReadPrec [ConnectorEntityField]
readPrec :: ReadPrec ConnectorEntityField
$creadPrec :: ReadPrec ConnectorEntityField
readList :: ReadS [ConnectorEntityField]
$creadList :: ReadS [ConnectorEntityField]
readsPrec :: Int -> ReadS ConnectorEntityField
$creadsPrec :: Int -> ReadS ConnectorEntityField
Prelude.Read, Int -> ConnectorEntityField -> ShowS
[ConnectorEntityField] -> ShowS
ConnectorEntityField -> String
(Int -> ConnectorEntityField -> ShowS)
-> (ConnectorEntityField -> String)
-> ([ConnectorEntityField] -> ShowS)
-> Show ConnectorEntityField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectorEntityField] -> ShowS
$cshowList :: [ConnectorEntityField] -> ShowS
show :: ConnectorEntityField -> String
$cshow :: ConnectorEntityField -> String
showsPrec :: Int -> ConnectorEntityField -> ShowS
$cshowsPrec :: Int -> ConnectorEntityField -> ShowS
Prelude.Show, (forall x. ConnectorEntityField -> Rep ConnectorEntityField x)
-> (forall x. Rep ConnectorEntityField x -> ConnectorEntityField)
-> Generic ConnectorEntityField
forall x. Rep ConnectorEntityField x -> ConnectorEntityField
forall x. ConnectorEntityField -> Rep ConnectorEntityField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectorEntityField x -> ConnectorEntityField
$cfrom :: forall x. ConnectorEntityField -> Rep ConnectorEntityField x
Prelude.Generic)

-- |
-- Create a value of 'ConnectorEntityField' 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:
--
-- 'sourceProperties', 'connectorEntityField_sourceProperties' - The properties that can be applied to a field when the connector is
-- being used as a source.
--
-- 'supportedFieldTypeDetails', 'connectorEntityField_supportedFieldTypeDetails' - Contains details regarding the supported @FieldType@, including the
-- corresponding @filterOperators@ and @supportedValues@.
--
-- 'destinationProperties', 'connectorEntityField_destinationProperties' - The properties applied to a field when the connector is being used as a
-- destination.
--
-- 'description', 'connectorEntityField_description' - A description of the connector entity field.
--
-- 'label', 'connectorEntityField_label' - The label applied to a connector entity field.
--
-- 'identifier', 'connectorEntityField_identifier' - The unique identifier of the connector field.
newConnectorEntityField ::
  -- | 'identifier'
  Prelude.Text ->
  ConnectorEntityField
newConnectorEntityField :: Text -> ConnectorEntityField
newConnectorEntityField Text
pIdentifier_ =
  ConnectorEntityField' :: Maybe SourceFieldProperties
-> Maybe SupportedFieldTypeDetails
-> Maybe DestinationFieldProperties
-> Maybe Text
-> Maybe Text
-> Text
-> ConnectorEntityField
ConnectorEntityField'
    { $sel:sourceProperties:ConnectorEntityField' :: Maybe SourceFieldProperties
sourceProperties =
        Maybe SourceFieldProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedFieldTypeDetails:ConnectorEntityField' :: Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails = Maybe SupportedFieldTypeDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationProperties:ConnectorEntityField' :: Maybe DestinationFieldProperties
destinationProperties = Maybe DestinationFieldProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ConnectorEntityField' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:label:ConnectorEntityField' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:ConnectorEntityField' :: Text
identifier = Text
pIdentifier_
    }

-- | The properties that can be applied to a field when the connector is
-- being used as a source.
connectorEntityField_sourceProperties :: Lens.Lens' ConnectorEntityField (Prelude.Maybe SourceFieldProperties)
connectorEntityField_sourceProperties :: (Maybe SourceFieldProperties -> f (Maybe SourceFieldProperties))
-> ConnectorEntityField -> f ConnectorEntityField
connectorEntityField_sourceProperties = (ConnectorEntityField -> Maybe SourceFieldProperties)
-> (ConnectorEntityField
    -> Maybe SourceFieldProperties -> ConnectorEntityField)
-> Lens
     ConnectorEntityField
     ConnectorEntityField
     (Maybe SourceFieldProperties)
     (Maybe SourceFieldProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntityField' {Maybe SourceFieldProperties
sourceProperties :: Maybe SourceFieldProperties
$sel:sourceProperties:ConnectorEntityField' :: ConnectorEntityField -> Maybe SourceFieldProperties
sourceProperties} -> Maybe SourceFieldProperties
sourceProperties) (\s :: ConnectorEntityField
s@ConnectorEntityField' {} Maybe SourceFieldProperties
a -> ConnectorEntityField
s {$sel:sourceProperties:ConnectorEntityField' :: Maybe SourceFieldProperties
sourceProperties = Maybe SourceFieldProperties
a} :: ConnectorEntityField)

-- | Contains details regarding the supported @FieldType@, including the
-- corresponding @filterOperators@ and @supportedValues@.
connectorEntityField_supportedFieldTypeDetails :: Lens.Lens' ConnectorEntityField (Prelude.Maybe SupportedFieldTypeDetails)
connectorEntityField_supportedFieldTypeDetails :: (Maybe SupportedFieldTypeDetails
 -> f (Maybe SupportedFieldTypeDetails))
-> ConnectorEntityField -> f ConnectorEntityField
connectorEntityField_supportedFieldTypeDetails = (ConnectorEntityField -> Maybe SupportedFieldTypeDetails)
-> (ConnectorEntityField
    -> Maybe SupportedFieldTypeDetails -> ConnectorEntityField)
-> Lens
     ConnectorEntityField
     ConnectorEntityField
     (Maybe SupportedFieldTypeDetails)
     (Maybe SupportedFieldTypeDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntityField' {Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails :: Maybe SupportedFieldTypeDetails
$sel:supportedFieldTypeDetails:ConnectorEntityField' :: ConnectorEntityField -> Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails} -> Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails) (\s :: ConnectorEntityField
s@ConnectorEntityField' {} Maybe SupportedFieldTypeDetails
a -> ConnectorEntityField
s {$sel:supportedFieldTypeDetails:ConnectorEntityField' :: Maybe SupportedFieldTypeDetails
supportedFieldTypeDetails = Maybe SupportedFieldTypeDetails
a} :: ConnectorEntityField)

-- | The properties applied to a field when the connector is being used as a
-- destination.
connectorEntityField_destinationProperties :: Lens.Lens' ConnectorEntityField (Prelude.Maybe DestinationFieldProperties)
connectorEntityField_destinationProperties :: (Maybe DestinationFieldProperties
 -> f (Maybe DestinationFieldProperties))
-> ConnectorEntityField -> f ConnectorEntityField
connectorEntityField_destinationProperties = (ConnectorEntityField -> Maybe DestinationFieldProperties)
-> (ConnectorEntityField
    -> Maybe DestinationFieldProperties -> ConnectorEntityField)
-> Lens
     ConnectorEntityField
     ConnectorEntityField
     (Maybe DestinationFieldProperties)
     (Maybe DestinationFieldProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntityField' {Maybe DestinationFieldProperties
destinationProperties :: Maybe DestinationFieldProperties
$sel:destinationProperties:ConnectorEntityField' :: ConnectorEntityField -> Maybe DestinationFieldProperties
destinationProperties} -> Maybe DestinationFieldProperties
destinationProperties) (\s :: ConnectorEntityField
s@ConnectorEntityField' {} Maybe DestinationFieldProperties
a -> ConnectorEntityField
s {$sel:destinationProperties:ConnectorEntityField' :: Maybe DestinationFieldProperties
destinationProperties = Maybe DestinationFieldProperties
a} :: ConnectorEntityField)

-- | A description of the connector entity field.
connectorEntityField_description :: Lens.Lens' ConnectorEntityField (Prelude.Maybe Prelude.Text)
connectorEntityField_description :: (Maybe Text -> f (Maybe Text))
-> ConnectorEntityField -> f ConnectorEntityField
connectorEntityField_description = (ConnectorEntityField -> Maybe Text)
-> (ConnectorEntityField -> Maybe Text -> ConnectorEntityField)
-> Lens
     ConnectorEntityField ConnectorEntityField (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntityField' {Maybe Text
description :: Maybe Text
$sel:description:ConnectorEntityField' :: ConnectorEntityField -> Maybe Text
description} -> Maybe Text
description) (\s :: ConnectorEntityField
s@ConnectorEntityField' {} Maybe Text
a -> ConnectorEntityField
s {$sel:description:ConnectorEntityField' :: Maybe Text
description = Maybe Text
a} :: ConnectorEntityField)

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

-- | The unique identifier of the connector field.
connectorEntityField_identifier :: Lens.Lens' ConnectorEntityField Prelude.Text
connectorEntityField_identifier :: (Text -> f Text) -> ConnectorEntityField -> f ConnectorEntityField
connectorEntityField_identifier = (ConnectorEntityField -> Text)
-> (ConnectorEntityField -> Text -> ConnectorEntityField)
-> Lens ConnectorEntityField ConnectorEntityField Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntityField' {Text
identifier :: Text
$sel:identifier:ConnectorEntityField' :: ConnectorEntityField -> Text
identifier} -> Text
identifier) (\s :: ConnectorEntityField
s@ConnectorEntityField' {} Text
a -> ConnectorEntityField
s {$sel:identifier:ConnectorEntityField' :: Text
identifier = Text
a} :: ConnectorEntityField)

instance Core.FromJSON ConnectorEntityField where
  parseJSON :: Value -> Parser ConnectorEntityField
parseJSON =
    String
-> (Object -> Parser ConnectorEntityField)
-> Value
-> Parser ConnectorEntityField
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectorEntityField"
      ( \Object
x ->
          Maybe SourceFieldProperties
-> Maybe SupportedFieldTypeDetails
-> Maybe DestinationFieldProperties
-> Maybe Text
-> Maybe Text
-> Text
-> ConnectorEntityField
ConnectorEntityField'
            (Maybe SourceFieldProperties
 -> Maybe SupportedFieldTypeDetails
 -> Maybe DestinationFieldProperties
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> ConnectorEntityField)
-> Parser (Maybe SourceFieldProperties)
-> Parser
     (Maybe SupportedFieldTypeDetails
      -> Maybe DestinationFieldProperties
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> ConnectorEntityField)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SourceFieldProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sourceProperties")
            Parser
  (Maybe SupportedFieldTypeDetails
   -> Maybe DestinationFieldProperties
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> ConnectorEntityField)
-> Parser (Maybe SupportedFieldTypeDetails)
-> Parser
     (Maybe DestinationFieldProperties
      -> Maybe Text -> Maybe Text -> Text -> ConnectorEntityField)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SupportedFieldTypeDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"supportedFieldTypeDetails")
            Parser
  (Maybe DestinationFieldProperties
   -> Maybe Text -> Maybe Text -> Text -> ConnectorEntityField)
-> Parser (Maybe DestinationFieldProperties)
-> Parser
     (Maybe Text -> Maybe Text -> Text -> ConnectorEntityField)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DestinationFieldProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinationProperties")
            Parser (Maybe Text -> Maybe Text -> Text -> ConnectorEntityField)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> ConnectorEntityField)
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
"description")
            Parser (Maybe Text -> Text -> ConnectorEntityField)
-> Parser (Maybe Text) -> Parser (Text -> ConnectorEntityField)
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
"label")
            Parser (Text -> ConnectorEntityField)
-> Parser Text -> Parser ConnectorEntityField
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"identifier")
      )

instance Prelude.Hashable ConnectorEntityField

instance Prelude.NFData ConnectorEntityField