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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LongColumnStatisticsData -> LongColumnStatisticsData -> Bool)
-> (LongColumnStatisticsData -> LongColumnStatisticsData -> Bool)
-> Eq LongColumnStatisticsData
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]
(Int -> ReadS LongColumnStatisticsData)
-> ReadS [LongColumnStatisticsData]
-> ReadPrec LongColumnStatisticsData
-> ReadPrec [LongColumnStatisticsData]
-> Read 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
(Int -> LongColumnStatisticsData -> ShowS)
-> (LongColumnStatisticsData -> String)
-> ([LongColumnStatisticsData] -> ShowS)
-> Show LongColumnStatisticsData
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.
 LongColumnStatisticsData -> Rep LongColumnStatisticsData x)
-> (forall x.
    Rep LongColumnStatisticsData x -> LongColumnStatisticsData)
-> Generic LongColumnStatisticsData
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' :: Maybe Integer
-> Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData
LongColumnStatisticsData'
      { $sel:maximumValue:LongColumnStatisticsData' :: Maybe Integer
maximumValue =
          Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:minimumValue:LongColumnStatisticsData' :: Maybe Integer
minimumValue = Maybe Integer
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 :: (Maybe Integer -> f (Maybe Integer))
-> LongColumnStatisticsData -> f LongColumnStatisticsData
longColumnStatisticsData_maximumValue = (LongColumnStatisticsData -> Maybe Integer)
-> (LongColumnStatisticsData
    -> Maybe Integer -> LongColumnStatisticsData)
-> Lens
     LongColumnStatisticsData
     LongColumnStatisticsData
     (Maybe Integer)
     (Maybe Integer)
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 :: (Maybe Integer -> f (Maybe Integer))
-> LongColumnStatisticsData -> f LongColumnStatisticsData
longColumnStatisticsData_minimumValue = (LongColumnStatisticsData -> Maybe Integer)
-> (LongColumnStatisticsData
    -> Maybe Integer -> LongColumnStatisticsData)
-> Lens
     LongColumnStatisticsData
     LongColumnStatisticsData
     (Maybe Integer)
     (Maybe Integer)
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 :: (Natural -> f Natural)
-> LongColumnStatisticsData -> f LongColumnStatisticsData
longColumnStatisticsData_numberOfNulls = (LongColumnStatisticsData -> Natural)
-> (LongColumnStatisticsData
    -> Natural -> LongColumnStatisticsData)
-> Lens
     LongColumnStatisticsData LongColumnStatisticsData Natural Natural
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 :: (Natural -> f Natural)
-> LongColumnStatisticsData -> f LongColumnStatisticsData
longColumnStatisticsData_numberOfDistinctValues = (LongColumnStatisticsData -> Natural)
-> (LongColumnStatisticsData
    -> Natural -> LongColumnStatisticsData)
-> Lens
     LongColumnStatisticsData LongColumnStatisticsData Natural Natural
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 Core.FromJSON LongColumnStatisticsData where
  parseJSON :: Value -> Parser LongColumnStatisticsData
parseJSON =
    String
-> (Object -> Parser LongColumnStatisticsData)
-> Value
-> Parser LongColumnStatisticsData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LongColumnStatisticsData"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData
LongColumnStatisticsData'
            (Maybe Integer
 -> Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaximumValue")
            Parser
  (Maybe Integer -> Natural -> Natural -> LongColumnStatisticsData)
-> Parser (Maybe Integer)
-> Parser (Natural -> Natural -> LongColumnStatisticsData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MinimumValue")
            Parser (Natural -> Natural -> LongColumnStatisticsData)
-> Parser Natural -> Parser (Natural -> LongColumnStatisticsData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"NumberOfNulls")
            Parser (Natural -> LongColumnStatisticsData)
-> Parser Natural -> Parser LongColumnStatisticsData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"NumberOfDistinctValues")
      )

instance Prelude.Hashable LongColumnStatisticsData

instance Prelude.NFData LongColumnStatisticsData

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MaximumValue" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
maximumValue,
            (Text
"MinimumValue" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
minimumValue,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"NumberOfNulls" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numberOfNulls),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"NumberOfDistinctValues"
                  Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numberOfDistinctValues
              )
          ]
      )