{-# 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.BooleanColumnStatisticsData
-- 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.BooleanColumnStatisticsData where

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

-- | Defines column statistics supported for Boolean data columns.
--
-- /See:/ 'newBooleanColumnStatisticsData' smart constructor.
data BooleanColumnStatisticsData = BooleanColumnStatisticsData'
  { -- | The number of true values in the column.
    BooleanColumnStatisticsData -> Natural
numberOfTrues :: Prelude.Natural,
    -- | The number of false values in the column.
    BooleanColumnStatisticsData -> Natural
numberOfFalses :: Prelude.Natural,
    -- | The number of null values in the column.
    BooleanColumnStatisticsData -> Natural
numberOfNulls :: Prelude.Natural
  }
  deriving (BooleanColumnStatisticsData -> BooleanColumnStatisticsData -> Bool
(BooleanColumnStatisticsData
 -> BooleanColumnStatisticsData -> Bool)
-> (BooleanColumnStatisticsData
    -> BooleanColumnStatisticsData -> Bool)
-> Eq BooleanColumnStatisticsData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BooleanColumnStatisticsData -> BooleanColumnStatisticsData -> Bool
$c/= :: BooleanColumnStatisticsData -> BooleanColumnStatisticsData -> Bool
== :: BooleanColumnStatisticsData -> BooleanColumnStatisticsData -> Bool
$c== :: BooleanColumnStatisticsData -> BooleanColumnStatisticsData -> Bool
Prelude.Eq, ReadPrec [BooleanColumnStatisticsData]
ReadPrec BooleanColumnStatisticsData
Int -> ReadS BooleanColumnStatisticsData
ReadS [BooleanColumnStatisticsData]
(Int -> ReadS BooleanColumnStatisticsData)
-> ReadS [BooleanColumnStatisticsData]
-> ReadPrec BooleanColumnStatisticsData
-> ReadPrec [BooleanColumnStatisticsData]
-> Read BooleanColumnStatisticsData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BooleanColumnStatisticsData]
$creadListPrec :: ReadPrec [BooleanColumnStatisticsData]
readPrec :: ReadPrec BooleanColumnStatisticsData
$creadPrec :: ReadPrec BooleanColumnStatisticsData
readList :: ReadS [BooleanColumnStatisticsData]
$creadList :: ReadS [BooleanColumnStatisticsData]
readsPrec :: Int -> ReadS BooleanColumnStatisticsData
$creadsPrec :: Int -> ReadS BooleanColumnStatisticsData
Prelude.Read, Int -> BooleanColumnStatisticsData -> ShowS
[BooleanColumnStatisticsData] -> ShowS
BooleanColumnStatisticsData -> String
(Int -> BooleanColumnStatisticsData -> ShowS)
-> (BooleanColumnStatisticsData -> String)
-> ([BooleanColumnStatisticsData] -> ShowS)
-> Show BooleanColumnStatisticsData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BooleanColumnStatisticsData] -> ShowS
$cshowList :: [BooleanColumnStatisticsData] -> ShowS
show :: BooleanColumnStatisticsData -> String
$cshow :: BooleanColumnStatisticsData -> String
showsPrec :: Int -> BooleanColumnStatisticsData -> ShowS
$cshowsPrec :: Int -> BooleanColumnStatisticsData -> ShowS
Prelude.Show, (forall x.
 BooleanColumnStatisticsData -> Rep BooleanColumnStatisticsData x)
-> (forall x.
    Rep BooleanColumnStatisticsData x -> BooleanColumnStatisticsData)
-> Generic BooleanColumnStatisticsData
forall x.
Rep BooleanColumnStatisticsData x -> BooleanColumnStatisticsData
forall x.
BooleanColumnStatisticsData -> Rep BooleanColumnStatisticsData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BooleanColumnStatisticsData x -> BooleanColumnStatisticsData
$cfrom :: forall x.
BooleanColumnStatisticsData -> Rep BooleanColumnStatisticsData x
Prelude.Generic)

-- |
-- Create a value of 'BooleanColumnStatisticsData' 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:
--
-- 'numberOfTrues', 'booleanColumnStatisticsData_numberOfTrues' - The number of true values in the column.
--
-- 'numberOfFalses', 'booleanColumnStatisticsData_numberOfFalses' - The number of false values in the column.
--
-- 'numberOfNulls', 'booleanColumnStatisticsData_numberOfNulls' - The number of null values in the column.
newBooleanColumnStatisticsData ::
  -- | 'numberOfTrues'
  Prelude.Natural ->
  -- | 'numberOfFalses'
  Prelude.Natural ->
  -- | 'numberOfNulls'
  Prelude.Natural ->
  BooleanColumnStatisticsData
newBooleanColumnStatisticsData :: Natural -> Natural -> Natural -> BooleanColumnStatisticsData
newBooleanColumnStatisticsData
  Natural
pNumberOfTrues_
  Natural
pNumberOfFalses_
  Natural
pNumberOfNulls_ =
    BooleanColumnStatisticsData' :: Natural -> Natural -> Natural -> BooleanColumnStatisticsData
BooleanColumnStatisticsData'
      { $sel:numberOfTrues:BooleanColumnStatisticsData' :: Natural
numberOfTrues =
          Natural
pNumberOfTrues_,
        $sel:numberOfFalses:BooleanColumnStatisticsData' :: Natural
numberOfFalses = Natural
pNumberOfFalses_,
        $sel:numberOfNulls:BooleanColumnStatisticsData' :: Natural
numberOfNulls = Natural
pNumberOfNulls_
      }

-- | The number of true values in the column.
booleanColumnStatisticsData_numberOfTrues :: Lens.Lens' BooleanColumnStatisticsData Prelude.Natural
booleanColumnStatisticsData_numberOfTrues :: (Natural -> f Natural)
-> BooleanColumnStatisticsData -> f BooleanColumnStatisticsData
booleanColumnStatisticsData_numberOfTrues = (BooleanColumnStatisticsData -> Natural)
-> (BooleanColumnStatisticsData
    -> Natural -> BooleanColumnStatisticsData)
-> Lens
     BooleanColumnStatisticsData
     BooleanColumnStatisticsData
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BooleanColumnStatisticsData' {Natural
numberOfTrues :: Natural
$sel:numberOfTrues:BooleanColumnStatisticsData' :: BooleanColumnStatisticsData -> Natural
numberOfTrues} -> Natural
numberOfTrues) (\s :: BooleanColumnStatisticsData
s@BooleanColumnStatisticsData' {} Natural
a -> BooleanColumnStatisticsData
s {$sel:numberOfTrues:BooleanColumnStatisticsData' :: Natural
numberOfTrues = Natural
a} :: BooleanColumnStatisticsData)

-- | The number of false values in the column.
booleanColumnStatisticsData_numberOfFalses :: Lens.Lens' BooleanColumnStatisticsData Prelude.Natural
booleanColumnStatisticsData_numberOfFalses :: (Natural -> f Natural)
-> BooleanColumnStatisticsData -> f BooleanColumnStatisticsData
booleanColumnStatisticsData_numberOfFalses = (BooleanColumnStatisticsData -> Natural)
-> (BooleanColumnStatisticsData
    -> Natural -> BooleanColumnStatisticsData)
-> Lens
     BooleanColumnStatisticsData
     BooleanColumnStatisticsData
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BooleanColumnStatisticsData' {Natural
numberOfFalses :: Natural
$sel:numberOfFalses:BooleanColumnStatisticsData' :: BooleanColumnStatisticsData -> Natural
numberOfFalses} -> Natural
numberOfFalses) (\s :: BooleanColumnStatisticsData
s@BooleanColumnStatisticsData' {} Natural
a -> BooleanColumnStatisticsData
s {$sel:numberOfFalses:BooleanColumnStatisticsData' :: Natural
numberOfFalses = Natural
a} :: BooleanColumnStatisticsData)

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

instance Core.FromJSON BooleanColumnStatisticsData where
  parseJSON :: Value -> Parser BooleanColumnStatisticsData
parseJSON =
    String
-> (Object -> Parser BooleanColumnStatisticsData)
-> Value
-> Parser BooleanColumnStatisticsData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BooleanColumnStatisticsData"
      ( \Object
x ->
          Natural -> Natural -> Natural -> BooleanColumnStatisticsData
BooleanColumnStatisticsData'
            (Natural -> Natural -> Natural -> BooleanColumnStatisticsData)
-> Parser Natural
-> Parser (Natural -> Natural -> BooleanColumnStatisticsData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"NumberOfTrues")
            Parser (Natural -> Natural -> BooleanColumnStatisticsData)
-> Parser Natural
-> Parser (Natural -> BooleanColumnStatisticsData)
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
"NumberOfFalses")
            Parser (Natural -> BooleanColumnStatisticsData)
-> Parser Natural -> Parser BooleanColumnStatisticsData
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")
      )

instance Prelude.Hashable BooleanColumnStatisticsData

instance Prelude.NFData BooleanColumnStatisticsData

instance Core.ToJSON BooleanColumnStatisticsData where
  toJSON :: BooleanColumnStatisticsData -> Value
toJSON BooleanColumnStatisticsData' {Natural
numberOfNulls :: Natural
numberOfFalses :: Natural
numberOfTrues :: Natural
$sel:numberOfNulls:BooleanColumnStatisticsData' :: BooleanColumnStatisticsData -> Natural
$sel:numberOfFalses:BooleanColumnStatisticsData' :: BooleanColumnStatisticsData -> Natural
$sel:numberOfTrues:BooleanColumnStatisticsData' :: BooleanColumnStatisticsData -> Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"NumberOfTrues" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numberOfTrues),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"NumberOfFalses" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numberOfFalses),
            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)
          ]
      )