{-# 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.DataBrew.Types.AllowedStatistics
-- 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.DataBrew.Types.AllowedStatistics 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

-- | Configuration of statistics that are allowed to be run on columns that
-- contain detected entities. When undefined, no statistics will be
-- computed on columns that contain detected entities.
--
-- /See:/ 'newAllowedStatistics' smart constructor.
data AllowedStatistics = AllowedStatistics'
  { -- | One or more column statistics to allow for columns that contain detected
    -- entities.
    AllowedStatistics -> NonEmpty Text
statistics :: Prelude.NonEmpty Prelude.Text
  }
  deriving (AllowedStatistics -> AllowedStatistics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AllowedStatistics -> AllowedStatistics -> Bool
$c/= :: AllowedStatistics -> AllowedStatistics -> Bool
== :: AllowedStatistics -> AllowedStatistics -> Bool
$c== :: AllowedStatistics -> AllowedStatistics -> Bool
Prelude.Eq, ReadPrec [AllowedStatistics]
ReadPrec AllowedStatistics
Int -> ReadS AllowedStatistics
ReadS [AllowedStatistics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AllowedStatistics]
$creadListPrec :: ReadPrec [AllowedStatistics]
readPrec :: ReadPrec AllowedStatistics
$creadPrec :: ReadPrec AllowedStatistics
readList :: ReadS [AllowedStatistics]
$creadList :: ReadS [AllowedStatistics]
readsPrec :: Int -> ReadS AllowedStatistics
$creadsPrec :: Int -> ReadS AllowedStatistics
Prelude.Read, Int -> AllowedStatistics -> ShowS
[AllowedStatistics] -> ShowS
AllowedStatistics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AllowedStatistics] -> ShowS
$cshowList :: [AllowedStatistics] -> ShowS
show :: AllowedStatistics -> String
$cshow :: AllowedStatistics -> String
showsPrec :: Int -> AllowedStatistics -> ShowS
$cshowsPrec :: Int -> AllowedStatistics -> ShowS
Prelude.Show, forall x. Rep AllowedStatistics x -> AllowedStatistics
forall x. AllowedStatistics -> Rep AllowedStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AllowedStatistics x -> AllowedStatistics
$cfrom :: forall x. AllowedStatistics -> Rep AllowedStatistics x
Prelude.Generic)

-- |
-- Create a value of 'AllowedStatistics' 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:
--
-- 'statistics', 'allowedStatistics_statistics' - One or more column statistics to allow for columns that contain detected
-- entities.
newAllowedStatistics ::
  -- | 'statistics'
  Prelude.NonEmpty Prelude.Text ->
  AllowedStatistics
newAllowedStatistics :: NonEmpty Text -> AllowedStatistics
newAllowedStatistics NonEmpty Text
pStatistics_ =
  AllowedStatistics'
    { $sel:statistics:AllowedStatistics' :: NonEmpty Text
statistics =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pStatistics_
    }

-- | One or more column statistics to allow for columns that contain detected
-- entities.
allowedStatistics_statistics :: Lens.Lens' AllowedStatistics (Prelude.NonEmpty Prelude.Text)
allowedStatistics_statistics :: Lens' AllowedStatistics (NonEmpty Text)
allowedStatistics_statistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AllowedStatistics' {NonEmpty Text
statistics :: NonEmpty Text
$sel:statistics:AllowedStatistics' :: AllowedStatistics -> NonEmpty Text
statistics} -> NonEmpty Text
statistics) (\s :: AllowedStatistics
s@AllowedStatistics' {} NonEmpty Text
a -> AllowedStatistics
s {$sel:statistics:AllowedStatistics' :: NonEmpty Text
statistics = NonEmpty Text
a} :: AllowedStatistics) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AllowedStatistics where
  parseJSON :: Value -> Parser AllowedStatistics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AllowedStatistics"
      ( \Object
x ->
          NonEmpty Text -> AllowedStatistics
AllowedStatistics'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Statistics")
      )

instance Prelude.Hashable AllowedStatistics where
  hashWithSalt :: Int -> AllowedStatistics -> Int
hashWithSalt Int
_salt AllowedStatistics' {NonEmpty Text
statistics :: NonEmpty Text
$sel:statistics:AllowedStatistics' :: AllowedStatistics -> NonEmpty Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
statistics

instance Prelude.NFData AllowedStatistics where
  rnf :: AllowedStatistics -> ()
rnf AllowedStatistics' {NonEmpty Text
statistics :: NonEmpty Text
$sel:statistics:AllowedStatistics' :: AllowedStatistics -> NonEmpty Text
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
statistics

instance Data.ToJSON AllowedStatistics where
  toJSON :: AllowedStatistics -> Value
toJSON AllowedStatistics' {NonEmpty Text
statistics :: NonEmpty Text
$sel:statistics:AllowedStatistics' :: AllowedStatistics -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Statistics" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
statistics)]
      )