{-# 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.SourceFieldProperties
-- 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.SourceFieldProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The properties that can be applied to a field when the connector is
-- being used as a source.
--
-- /See:/ 'newSourceFieldProperties' smart constructor.
data SourceFieldProperties = SourceFieldProperties'
  { -- | Indicates whether the field can be returned in a search result.
    SourceFieldProperties -> Maybe Bool
isRetrievable :: Prelude.Maybe Prelude.Bool,
    -- | Indicates if the field can be queried.
    SourceFieldProperties -> Maybe Bool
isQueryable :: Prelude.Maybe Prelude.Bool
  }
  deriving (SourceFieldProperties -> SourceFieldProperties -> Bool
(SourceFieldProperties -> SourceFieldProperties -> Bool)
-> (SourceFieldProperties -> SourceFieldProperties -> Bool)
-> Eq SourceFieldProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceFieldProperties -> SourceFieldProperties -> Bool
$c/= :: SourceFieldProperties -> SourceFieldProperties -> Bool
== :: SourceFieldProperties -> SourceFieldProperties -> Bool
$c== :: SourceFieldProperties -> SourceFieldProperties -> Bool
Prelude.Eq, ReadPrec [SourceFieldProperties]
ReadPrec SourceFieldProperties
Int -> ReadS SourceFieldProperties
ReadS [SourceFieldProperties]
(Int -> ReadS SourceFieldProperties)
-> ReadS [SourceFieldProperties]
-> ReadPrec SourceFieldProperties
-> ReadPrec [SourceFieldProperties]
-> Read SourceFieldProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceFieldProperties]
$creadListPrec :: ReadPrec [SourceFieldProperties]
readPrec :: ReadPrec SourceFieldProperties
$creadPrec :: ReadPrec SourceFieldProperties
readList :: ReadS [SourceFieldProperties]
$creadList :: ReadS [SourceFieldProperties]
readsPrec :: Int -> ReadS SourceFieldProperties
$creadsPrec :: Int -> ReadS SourceFieldProperties
Prelude.Read, Int -> SourceFieldProperties -> ShowS
[SourceFieldProperties] -> ShowS
SourceFieldProperties -> String
(Int -> SourceFieldProperties -> ShowS)
-> (SourceFieldProperties -> String)
-> ([SourceFieldProperties] -> ShowS)
-> Show SourceFieldProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceFieldProperties] -> ShowS
$cshowList :: [SourceFieldProperties] -> ShowS
show :: SourceFieldProperties -> String
$cshow :: SourceFieldProperties -> String
showsPrec :: Int -> SourceFieldProperties -> ShowS
$cshowsPrec :: Int -> SourceFieldProperties -> ShowS
Prelude.Show, (forall x. SourceFieldProperties -> Rep SourceFieldProperties x)
-> (forall x. Rep SourceFieldProperties x -> SourceFieldProperties)
-> Generic SourceFieldProperties
forall x. Rep SourceFieldProperties x -> SourceFieldProperties
forall x. SourceFieldProperties -> Rep SourceFieldProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceFieldProperties x -> SourceFieldProperties
$cfrom :: forall x. SourceFieldProperties -> Rep SourceFieldProperties x
Prelude.Generic)

-- |
-- Create a value of 'SourceFieldProperties' 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:
--
-- 'isRetrievable', 'sourceFieldProperties_isRetrievable' - Indicates whether the field can be returned in a search result.
--
-- 'isQueryable', 'sourceFieldProperties_isQueryable' - Indicates if the field can be queried.
newSourceFieldProperties ::
  SourceFieldProperties
newSourceFieldProperties :: SourceFieldProperties
newSourceFieldProperties =
  SourceFieldProperties' :: Maybe Bool -> Maybe Bool -> SourceFieldProperties
SourceFieldProperties'
    { $sel:isRetrievable:SourceFieldProperties' :: Maybe Bool
isRetrievable =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isQueryable:SourceFieldProperties' :: Maybe Bool
isQueryable = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the field can be returned in a search result.
sourceFieldProperties_isRetrievable :: Lens.Lens' SourceFieldProperties (Prelude.Maybe Prelude.Bool)
sourceFieldProperties_isRetrievable :: (Maybe Bool -> f (Maybe Bool))
-> SourceFieldProperties -> f SourceFieldProperties
sourceFieldProperties_isRetrievable = (SourceFieldProperties -> Maybe Bool)
-> (SourceFieldProperties -> Maybe Bool -> SourceFieldProperties)
-> Lens
     SourceFieldProperties
     SourceFieldProperties
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFieldProperties' {Maybe Bool
isRetrievable :: Maybe Bool
$sel:isRetrievable:SourceFieldProperties' :: SourceFieldProperties -> Maybe Bool
isRetrievable} -> Maybe Bool
isRetrievable) (\s :: SourceFieldProperties
s@SourceFieldProperties' {} Maybe Bool
a -> SourceFieldProperties
s {$sel:isRetrievable:SourceFieldProperties' :: Maybe Bool
isRetrievable = Maybe Bool
a} :: SourceFieldProperties)

-- | Indicates if the field can be queried.
sourceFieldProperties_isQueryable :: Lens.Lens' SourceFieldProperties (Prelude.Maybe Prelude.Bool)
sourceFieldProperties_isQueryable :: (Maybe Bool -> f (Maybe Bool))
-> SourceFieldProperties -> f SourceFieldProperties
sourceFieldProperties_isQueryable = (SourceFieldProperties -> Maybe Bool)
-> (SourceFieldProperties -> Maybe Bool -> SourceFieldProperties)
-> Lens
     SourceFieldProperties
     SourceFieldProperties
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFieldProperties' {Maybe Bool
isQueryable :: Maybe Bool
$sel:isQueryable:SourceFieldProperties' :: SourceFieldProperties -> Maybe Bool
isQueryable} -> Maybe Bool
isQueryable) (\s :: SourceFieldProperties
s@SourceFieldProperties' {} Maybe Bool
a -> SourceFieldProperties
s {$sel:isQueryable:SourceFieldProperties' :: Maybe Bool
isQueryable = Maybe Bool
a} :: SourceFieldProperties)

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

instance Prelude.Hashable SourceFieldProperties

instance Prelude.NFData SourceFieldProperties