{-# 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.HoneyCode.Types.SourceDataColumnProperties
-- 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.HoneyCode.Types.SourceDataColumnProperties where

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

-- | An object that contains the properties for importing data to a specific
-- column in a table.
--
-- /See:/ 'newSourceDataColumnProperties' smart constructor.
data SourceDataColumnProperties = SourceDataColumnProperties'
  { -- | The index of the column in the input file.
    SourceDataColumnProperties -> Maybe Natural
columnIndex :: Prelude.Maybe Prelude.Natural
  }
  deriving (SourceDataColumnProperties -> SourceDataColumnProperties -> Bool
(SourceDataColumnProperties -> SourceDataColumnProperties -> Bool)
-> (SourceDataColumnProperties
    -> SourceDataColumnProperties -> Bool)
-> Eq SourceDataColumnProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceDataColumnProperties -> SourceDataColumnProperties -> Bool
$c/= :: SourceDataColumnProperties -> SourceDataColumnProperties -> Bool
== :: SourceDataColumnProperties -> SourceDataColumnProperties -> Bool
$c== :: SourceDataColumnProperties -> SourceDataColumnProperties -> Bool
Prelude.Eq, ReadPrec [SourceDataColumnProperties]
ReadPrec SourceDataColumnProperties
Int -> ReadS SourceDataColumnProperties
ReadS [SourceDataColumnProperties]
(Int -> ReadS SourceDataColumnProperties)
-> ReadS [SourceDataColumnProperties]
-> ReadPrec SourceDataColumnProperties
-> ReadPrec [SourceDataColumnProperties]
-> Read SourceDataColumnProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceDataColumnProperties]
$creadListPrec :: ReadPrec [SourceDataColumnProperties]
readPrec :: ReadPrec SourceDataColumnProperties
$creadPrec :: ReadPrec SourceDataColumnProperties
readList :: ReadS [SourceDataColumnProperties]
$creadList :: ReadS [SourceDataColumnProperties]
readsPrec :: Int -> ReadS SourceDataColumnProperties
$creadsPrec :: Int -> ReadS SourceDataColumnProperties
Prelude.Read, Int -> SourceDataColumnProperties -> ShowS
[SourceDataColumnProperties] -> ShowS
SourceDataColumnProperties -> String
(Int -> SourceDataColumnProperties -> ShowS)
-> (SourceDataColumnProperties -> String)
-> ([SourceDataColumnProperties] -> ShowS)
-> Show SourceDataColumnProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceDataColumnProperties] -> ShowS
$cshowList :: [SourceDataColumnProperties] -> ShowS
show :: SourceDataColumnProperties -> String
$cshow :: SourceDataColumnProperties -> String
showsPrec :: Int -> SourceDataColumnProperties -> ShowS
$cshowsPrec :: Int -> SourceDataColumnProperties -> ShowS
Prelude.Show, (forall x.
 SourceDataColumnProperties -> Rep SourceDataColumnProperties x)
-> (forall x.
    Rep SourceDataColumnProperties x -> SourceDataColumnProperties)
-> Generic SourceDataColumnProperties
forall x.
Rep SourceDataColumnProperties x -> SourceDataColumnProperties
forall x.
SourceDataColumnProperties -> Rep SourceDataColumnProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SourceDataColumnProperties x -> SourceDataColumnProperties
$cfrom :: forall x.
SourceDataColumnProperties -> Rep SourceDataColumnProperties x
Prelude.Generic)

-- |
-- Create a value of 'SourceDataColumnProperties' 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:
--
-- 'columnIndex', 'sourceDataColumnProperties_columnIndex' - The index of the column in the input file.
newSourceDataColumnProperties ::
  SourceDataColumnProperties
newSourceDataColumnProperties :: SourceDataColumnProperties
newSourceDataColumnProperties =
  SourceDataColumnProperties' :: Maybe Natural -> SourceDataColumnProperties
SourceDataColumnProperties'
    { $sel:columnIndex:SourceDataColumnProperties' :: Maybe Natural
columnIndex =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The index of the column in the input file.
sourceDataColumnProperties_columnIndex :: Lens.Lens' SourceDataColumnProperties (Prelude.Maybe Prelude.Natural)
sourceDataColumnProperties_columnIndex :: (Maybe Natural -> f (Maybe Natural))
-> SourceDataColumnProperties -> f SourceDataColumnProperties
sourceDataColumnProperties_columnIndex = (SourceDataColumnProperties -> Maybe Natural)
-> (SourceDataColumnProperties
    -> Maybe Natural -> SourceDataColumnProperties)
-> Lens
     SourceDataColumnProperties
     SourceDataColumnProperties
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceDataColumnProperties' {Maybe Natural
columnIndex :: Maybe Natural
$sel:columnIndex:SourceDataColumnProperties' :: SourceDataColumnProperties -> Maybe Natural
columnIndex} -> Maybe Natural
columnIndex) (\s :: SourceDataColumnProperties
s@SourceDataColumnProperties' {} Maybe Natural
a -> SourceDataColumnProperties
s {$sel:columnIndex:SourceDataColumnProperties' :: Maybe Natural
columnIndex = Maybe Natural
a} :: SourceDataColumnProperties)

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

instance Prelude.Hashable SourceDataColumnProperties

instance Prelude.NFData SourceDataColumnProperties

instance Core.ToJSON SourceDataColumnProperties where
  toJSON :: SourceDataColumnProperties -> Value
toJSON SourceDataColumnProperties' {Maybe Natural
columnIndex :: Maybe Natural
$sel:columnIndex:SourceDataColumnProperties' :: SourceDataColumnProperties -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"columnIndex" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
columnIndex]
      )