{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Athena.Types.Datum 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

-- | 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
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]
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
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. 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' {$sel:varCharValue:Datum' :: Maybe Text
varCharValue = forall a. Maybe a
Prelude.Nothing}

-- | The value of the datum.
datum_varCharValue :: Lens.Lens' Datum (Prelude.Maybe Prelude.Text)
datum_varCharValue :: Lens' Datum (Maybe Text)
datum_varCharValue = 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 Data.FromJSON Datum where
  parseJSON :: Value -> Parser Datum
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Datum"
      ( \Object
x ->
          Maybe Text -> Datum
Datum' 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
"VarCharValue")
      )

instance Prelude.Hashable Datum where
  hashWithSalt :: Int -> Datum -> Int
hashWithSalt Int
_salt Datum' {Maybe Text
varCharValue :: Maybe Text
$sel:varCharValue:Datum' :: Datum -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
varCharValue

instance Prelude.NFData Datum where
  rnf :: Datum -> ()
rnf Datum' {Maybe Text
varCharValue :: Maybe Text
$sel:varCharValue:Datum' :: Datum -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
varCharValue