{-# 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.Athena.Types.Datum
-- 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.Athena.Types.Datum where

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

-- | A piece of data (a field in the table).
--
-- /See:/ 'newDatum' smart constructor.
data Datum = Datum'
  { -- | The value of the datum.
    Datum -> Maybe Text
varCharValue :: Prelude.Maybe Prelude.Text
  }
  deriving (Datum -> Datum -> Bool
(Datum -> Datum -> Bool) -> (Datum -> Datum -> Bool) -> Eq Datum
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Datum -> Datum -> Bool
$c/= :: Datum -> Datum -> Bool
== :: Datum -> Datum -> Bool
$c== :: Datum -> Datum -> Bool
Prelude.Eq, ReadPrec [Datum]
ReadPrec Datum
Int -> ReadS Datum
ReadS [Datum]
(Int -> ReadS Datum)
-> ReadS [Datum]
-> ReadPrec Datum
-> ReadPrec [Datum]
-> Read Datum
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Datum]
$creadListPrec :: ReadPrec [Datum]
readPrec :: ReadPrec Datum
$creadPrec :: ReadPrec Datum
readList :: ReadS [Datum]
$creadList :: ReadS [Datum]
readsPrec :: Int -> ReadS Datum
$creadsPrec :: Int -> ReadS Datum
Prelude.Read, Int -> Datum -> ShowS
[Datum] -> ShowS
Datum -> String
(Int -> Datum -> ShowS)
-> (Datum -> String) -> ([Datum] -> ShowS) -> Show Datum
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Datum] -> ShowS
$cshowList :: [Datum] -> ShowS
show :: Datum -> String
$cshow :: Datum -> String
showsPrec :: Int -> Datum -> ShowS
$cshowsPrec :: Int -> Datum -> ShowS
Prelude.Show, (forall x. Datum -> Rep Datum x)
-> (forall x. Rep Datum x -> Datum) -> Generic Datum
forall x. Rep Datum x -> Datum
forall x. Datum -> Rep Datum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Datum x -> Datum
$cfrom :: forall x. Datum -> Rep Datum x
Prelude.Generic)

-- |
-- Create a value of 'Datum' 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:
--
-- 'varCharValue', 'datum_varCharValue' - The value of the datum.
newDatum ::
  Datum
newDatum :: Datum
newDatum = Datum' :: Maybe Text -> Datum
Datum' {$sel:varCharValue:Datum' :: Maybe Text
varCharValue = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The value of the datum.
datum_varCharValue :: Lens.Lens' Datum (Prelude.Maybe Prelude.Text)
datum_varCharValue :: (Maybe Text -> f (Maybe Text)) -> Datum -> f Datum
datum_varCharValue = (Datum -> Maybe Text)
-> (Datum -> Maybe Text -> Datum)
-> Lens Datum Datum (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datum' {Maybe Text
varCharValue :: Maybe Text
$sel:varCharValue:Datum' :: Datum -> Maybe Text
varCharValue} -> Maybe Text
varCharValue) (\s :: Datum
s@Datum' {} Maybe Text
a -> Datum
s {$sel:varCharValue:Datum' :: Maybe Text
varCharValue = Maybe Text
a} :: Datum)

instance Core.FromJSON Datum where
  parseJSON :: Value -> Parser Datum
parseJSON =
    String -> (Object -> Parser Datum) -> Value -> Parser Datum
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Datum"
      ( \Object
x ->
          Maybe Text -> Datum
Datum' (Maybe Text -> Datum) -> Parser (Maybe Text) -> Parser Datum
forall (f :: * -> *) a b. Functor 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
"VarCharValue")
      )

instance Prelude.Hashable Datum

instance Prelude.NFData Datum