{-# 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.Glue.Types.LongColumnStatisticsData
-- 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.Glue.Types.LongColumnStatisticsData 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

-- | Defines column statistics supported for integer data columns.
--
-- /See:/ 'newLongColumnStatisticsData' smart constructor.
data LongColumnStatisticsData = LongColumnStatisticsData'
  { -- | The highest value in the column.
    LongColumnStatisticsData -> Maybe Integer
maximumValue :: Prelude.Maybe Prelude.Integer,
    -- | The lowest value in the column.
    LongColumnStatisticsData -> Maybe Integer
minimumValue :: Prelude.Maybe Prelude.Integer,
    -- | The number of null values in the column.
    LongColumnStatisticsData -> Natural
numberOfNulls :: Prelude.Natural,
    -- | The number of distinct values in a column.
    LongColumnStatisticsData -> Natural
numberOfDistinctValues :: Prelude.Natural
  }
  deriving (LongColumnStatisticsData -> LongColumnStatisticsData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LongColumnStatisticsData -> LongColumnStatisticsData -> Bool
$c/= :: LongColumnStatisticsData -> LongColumnStatisticsData -> Bool
== :: LongColumnStatisticsData -> LongColumnStatisticsData -> Bool
$c== :: LongColumnStatisticsData -> LongColumnStatisticsData -> Bool
Prelude.Eq, ReadPrec [LongColumnStatisticsData]
ReadPrec LongColumnStatisticsData
Int -> ReadS LongColumnStatisticsData
ReadS [LongColumnStatisticsData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LongColumnStatisticsData]
$creadListPrec :: ReadPrec [LongColumnStatisticsData]
readPrec :: ReadPrec LongColumnStatisticsData
$creadPrec :: ReadPrec LongColumnStatisticsData
readList :: ReadS [LongColumnStatisticsData]
$creadList :: ReadS [LongColumnStatisticsData]
readsPrec :: Int -> ReadS LongColumnStatisticsData
$creadsPrec :: Int -> ReadS LongColumnStatisticsData
Prelude.Read, Int -> LongColumnStatisticsData -> ShowS
[LongColumnStatisticsData] -> ShowS
LongColumnStatisticsData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LongColumnStatisticsData] -> ShowS
$cshowList :: [LongColumnStatisticsData] -> ShowS
show :: LongColumnStatisticsData -> String
$cshow :: LongColumnStatisticsData -> String
showsPrec :: Int -> LongColumnStatisticsData -> ShowS
$cshowsPrec :: Int -> LongColumnStatisticsData -> ShowS
Prelude.Show, forall x.
Rep LongColumnStatisticsData x -> LongColumnStatisticsData
forall x.
LongColumnStatisticsData -> Rep LongColumnStatisticsData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LongColumnStatisticsData x -> LongColumnStatisticsData
$cfrom :: forall x.
LongColumnStatisticsData -> Rep LongColumnStatisticsData x
Prelude.Generic)

-- |
-- Create a value of 'LongColumnStatisticsData' 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:
--
-- 'maximumValue', 'longColumnStatisticsData_maximumValue' - The highest value in the column.
--
-- 'minimumValue', 'longColumnStatisticsData_minimumValue' - The lowest value in the column.
--
-- 'numberOfNulls', 'longColumnStatisticsData_numberOfNulls' - The number of null values in the column.
--
-- 'numberOfDistinctValues', 'longColumnStatisticsData_numberOfDistinctValues' - The number of distinct values in a column.
newLongColumnStatisticsData ::
  -- | 'numberOfNulls'
  Prelude.Natural ->
  -- | 'numberOfDistinctValues'
  Prelude.Natural ->
  LongColumnStatisticsData
newLongColumnStatisticsData :: Natural -> Natural -> LongColumnStatisticsData
newLongColumnStatisticsData
  Natural
pNumberOfNulls_
  Natural
pNumberOfDistinctValues_ =
    LongColumnStatisticsData'
      { $sel:maximumValue:LongColumnStatisticsData' :: Maybe Integer
maximumValue =
          forall a. Maybe a
Prelude.Nothing,
        $sel:minimumValue:LongColumnStatisticsData' :: Maybe Integer
minimumValue = forall a. Maybe a
Prelude.Nothing,
        $sel:numberOfNulls:LongColumnStatisticsData' :: Natural
numberOfNulls = Natural
pNumberOfNulls_,
        $sel:numberOfDistinctValues:LongColumnStatisticsData' :: Natural
numberOfDistinctValues = Natural
pNumberOfDistinctValues_
      }

-- | The highest value in the column.
longColumnStatisticsData_maximumValue :: Lens.Lens' LongColumnStatisticsData (Prelude.Maybe Prelude.Integer)
longColumnStatisticsData_maximumValue :: Lens' LongColumnStatisticsData (Maybe Integer)
longColumnStatisticsData_maximumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LongColumnStatisticsData' {Maybe Integer
maximumValue :: Maybe Integer
$sel:maximumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
maximumValue} -> Maybe Integer
maximumValue) (\s :: LongColumnStatisticsData
s@LongColumnStatisticsData' {} Maybe Integer
a -> LongColumnStatisticsData
s {$sel:maximumValue:LongColumnStatisticsData' :: Maybe Integer
maximumValue = Maybe Integer
a} :: LongColumnStatisticsData)

-- | The lowest value in the column.
longColumnStatisticsData_minimumValue :: Lens.Lens' LongColumnStatisticsData (Prelude.Maybe Prelude.Integer)
longColumnStatisticsData_minimumValue :: Lens' LongColumnStatisticsData (Maybe Integer)
longColumnStatisticsData_minimumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LongColumnStatisticsData' {Maybe Integer
minimumValue :: Maybe Integer
$sel:minimumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
minimumValue} -> Maybe Integer
minimumValue) (\s :: LongColumnStatisticsData
s@LongColumnStatisticsData' {} Maybe Integer
a -> LongColumnStatisticsData
s {$sel:minimumValue:LongColumnStatisticsData' :: Maybe Integer
minimumValue = Maybe Integer
a} :: LongColumnStatisticsData)

-- | The number of null values in the column.
longColumnStatisticsData_numberOfNulls :: Lens.Lens' LongColumnStatisticsData Prelude.Natural
longColumnStatisticsData_numberOfNulls :: Lens' LongColumnStatisticsData Natural
longColumnStatisticsData_numberOfNulls = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LongColumnStatisticsData' {Natural
numberOfNulls :: Natural
$sel:numberOfNulls:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
numberOfNulls} -> Natural
numberOfNulls) (\s :: LongColumnStatisticsData
s@LongColumnStatisticsData' {} Natural
a -> LongColumnStatisticsData
s {$sel:numberOfNulls:LongColumnStatisticsData' :: Natural
numberOfNulls = Natural
a} :: LongColumnStatisticsData)

-- | The number of distinct values in a column.
longColumnStatisticsData_numberOfDistinctValues :: Lens.Lens' LongColumnStatisticsData Prelude.Natural
longColumnStatisticsData_numberOfDistinctValues :: Lens' LongColumnStatisticsData Natural
longColumnStatisticsData_numberOfDistinctValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LongColumnStatisticsData' {Natural
numberOfDistinctValues :: Natural
$sel:numberOfDistinctValues:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
numberOfDistinctValues} -> Natural
numberOfDistinctValues) (\s :: LongColumnStatisticsData
s@LongColumnStatisticsData' {} Natural
a -> LongColumnStatisticsData
s {$sel:numberOfDistinctValues:LongColumnStatisticsData' :: Natural
numberOfDistinctValues = Natural
a} :: LongColumnStatisticsData)

instance Data.FromJSON LongColumnStatisticsData where
  parseJSON :: Value -> Parser LongColumnStatisticsData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LongColumnStatisticsData"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData
LongColumnStatisticsData'
            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
"MaximumValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MinimumValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NumberOfNulls")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NumberOfDistinctValues")
      )

instance Prelude.Hashable LongColumnStatisticsData where
  hashWithSalt :: Int -> LongColumnStatisticsData -> Int
hashWithSalt Int
_salt LongColumnStatisticsData' {Natural
Maybe Integer
numberOfDistinctValues :: Natural
numberOfNulls :: Natural
minimumValue :: Maybe Integer
maximumValue :: Maybe Integer
$sel:numberOfDistinctValues:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:numberOfNulls:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:minimumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
$sel:maximumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
maximumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
minimumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
numberOfNulls
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
numberOfDistinctValues

instance Prelude.NFData LongColumnStatisticsData where
  rnf :: LongColumnStatisticsData -> ()
rnf LongColumnStatisticsData' {Natural
Maybe Integer
numberOfDistinctValues :: Natural
numberOfNulls :: Natural
minimumValue :: Maybe Integer
maximumValue :: Maybe Integer
$sel:numberOfDistinctValues:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:numberOfNulls:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:minimumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
$sel:maximumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
maximumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
minimumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
numberOfNulls
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
numberOfDistinctValues

instance Data.ToJSON LongColumnStatisticsData where
  toJSON :: LongColumnStatisticsData -> Value
toJSON LongColumnStatisticsData' {Natural
Maybe Integer
numberOfDistinctValues :: Natural
numberOfNulls :: Natural
minimumValue :: Maybe Integer
maximumValue :: Maybe Integer
$sel:numberOfDistinctValues:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:numberOfNulls:LongColumnStatisticsData' :: LongColumnStatisticsData -> Natural
$sel:minimumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
$sel:maximumValue:LongColumnStatisticsData' :: LongColumnStatisticsData -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaximumValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
maximumValue,
            (Key
"MinimumValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
minimumValue,
            forall a. a -> Maybe a
Prelude.Just (Key
"NumberOfNulls" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
numberOfNulls),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"NumberOfDistinctValues"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
numberOfDistinctValues
              )
          ]
      )