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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.StatisticOverride
import qualified Amazonka.Prelude as Prelude

-- | Configuration of evaluations for a profile job. This configuration can
-- be used to select evaluations and override the parameters of selected
-- evaluations.
--
-- /See:/ 'newStatisticsConfiguration' smart constructor.
data StatisticsConfiguration = StatisticsConfiguration'
  { -- | List of included evaluations. When the list is undefined, all supported
    -- evaluations will be included.
    StatisticsConfiguration -> Maybe (NonEmpty Text)
includedStatistics :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | List of overrides for evaluations.
    StatisticsConfiguration -> Maybe (NonEmpty StatisticOverride)
overrides :: Prelude.Maybe (Prelude.NonEmpty StatisticOverride)
  }
  deriving (StatisticsConfiguration -> StatisticsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatisticsConfiguration -> StatisticsConfiguration -> Bool
$c/= :: StatisticsConfiguration -> StatisticsConfiguration -> Bool
== :: StatisticsConfiguration -> StatisticsConfiguration -> Bool
$c== :: StatisticsConfiguration -> StatisticsConfiguration -> Bool
Prelude.Eq, ReadPrec [StatisticsConfiguration]
ReadPrec StatisticsConfiguration
Int -> ReadS StatisticsConfiguration
ReadS [StatisticsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatisticsConfiguration]
$creadListPrec :: ReadPrec [StatisticsConfiguration]
readPrec :: ReadPrec StatisticsConfiguration
$creadPrec :: ReadPrec StatisticsConfiguration
readList :: ReadS [StatisticsConfiguration]
$creadList :: ReadS [StatisticsConfiguration]
readsPrec :: Int -> ReadS StatisticsConfiguration
$creadsPrec :: Int -> ReadS StatisticsConfiguration
Prelude.Read, Int -> StatisticsConfiguration -> ShowS
[StatisticsConfiguration] -> ShowS
StatisticsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatisticsConfiguration] -> ShowS
$cshowList :: [StatisticsConfiguration] -> ShowS
show :: StatisticsConfiguration -> String
$cshow :: StatisticsConfiguration -> String
showsPrec :: Int -> StatisticsConfiguration -> ShowS
$cshowsPrec :: Int -> StatisticsConfiguration -> ShowS
Prelude.Show, forall x. Rep StatisticsConfiguration x -> StatisticsConfiguration
forall x. StatisticsConfiguration -> Rep StatisticsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatisticsConfiguration x -> StatisticsConfiguration
$cfrom :: forall x. StatisticsConfiguration -> Rep StatisticsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'StatisticsConfiguration' 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:
--
-- 'includedStatistics', 'statisticsConfiguration_includedStatistics' - List of included evaluations. When the list is undefined, all supported
-- evaluations will be included.
--
-- 'overrides', 'statisticsConfiguration_overrides' - List of overrides for evaluations.
newStatisticsConfiguration ::
  StatisticsConfiguration
newStatisticsConfiguration :: StatisticsConfiguration
newStatisticsConfiguration =
  StatisticsConfiguration'
    { $sel:includedStatistics:StatisticsConfiguration' :: Maybe (NonEmpty Text)
includedStatistics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:overrides:StatisticsConfiguration' :: Maybe (NonEmpty StatisticOverride)
overrides = forall a. Maybe a
Prelude.Nothing
    }

-- | List of included evaluations. When the list is undefined, all supported
-- evaluations will be included.
statisticsConfiguration_includedStatistics :: Lens.Lens' StatisticsConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
statisticsConfiguration_includedStatistics :: Lens' StatisticsConfiguration (Maybe (NonEmpty Text))
statisticsConfiguration_includedStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticsConfiguration' {Maybe (NonEmpty Text)
includedStatistics :: Maybe (NonEmpty Text)
$sel:includedStatistics:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty Text)
includedStatistics} -> Maybe (NonEmpty Text)
includedStatistics) (\s :: StatisticsConfiguration
s@StatisticsConfiguration' {} Maybe (NonEmpty Text)
a -> StatisticsConfiguration
s {$sel:includedStatistics:StatisticsConfiguration' :: Maybe (NonEmpty Text)
includedStatistics = Maybe (NonEmpty Text)
a} :: StatisticsConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of overrides for evaluations.
statisticsConfiguration_overrides :: Lens.Lens' StatisticsConfiguration (Prelude.Maybe (Prelude.NonEmpty StatisticOverride))
statisticsConfiguration_overrides :: Lens' StatisticsConfiguration (Maybe (NonEmpty StatisticOverride))
statisticsConfiguration_overrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticsConfiguration' {Maybe (NonEmpty StatisticOverride)
overrides :: Maybe (NonEmpty StatisticOverride)
$sel:overrides:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty StatisticOverride)
overrides} -> Maybe (NonEmpty StatisticOverride)
overrides) (\s :: StatisticsConfiguration
s@StatisticsConfiguration' {} Maybe (NonEmpty StatisticOverride)
a -> StatisticsConfiguration
s {$sel:overrides:StatisticsConfiguration' :: Maybe (NonEmpty StatisticOverride)
overrides = Maybe (NonEmpty StatisticOverride)
a} :: StatisticsConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON StatisticsConfiguration where
  parseJSON :: Value -> Parser StatisticsConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StatisticsConfiguration"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe (NonEmpty StatisticOverride) -> StatisticsConfiguration
StatisticsConfiguration'
            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
"IncludedStatistics")
            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
"Overrides")
      )

instance Prelude.Hashable StatisticsConfiguration where
  hashWithSalt :: Int -> StatisticsConfiguration -> Int
hashWithSalt Int
_salt StatisticsConfiguration' {Maybe (NonEmpty Text)
Maybe (NonEmpty StatisticOverride)
overrides :: Maybe (NonEmpty StatisticOverride)
includedStatistics :: Maybe (NonEmpty Text)
$sel:overrides:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty StatisticOverride)
$sel:includedStatistics:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
includedStatistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty StatisticOverride)
overrides

instance Prelude.NFData StatisticsConfiguration where
  rnf :: StatisticsConfiguration -> ()
rnf StatisticsConfiguration' {Maybe (NonEmpty Text)
Maybe (NonEmpty StatisticOverride)
overrides :: Maybe (NonEmpty StatisticOverride)
includedStatistics :: Maybe (NonEmpty Text)
$sel:overrides:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty StatisticOverride)
$sel:includedStatistics:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
includedStatistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty StatisticOverride)
overrides

instance Data.ToJSON StatisticsConfiguration where
  toJSON :: StatisticsConfiguration -> Value
toJSON StatisticsConfiguration' {Maybe (NonEmpty Text)
Maybe (NonEmpty StatisticOverride)
overrides :: Maybe (NonEmpty StatisticOverride)
includedStatistics :: Maybe (NonEmpty Text)
$sel:overrides:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty StatisticOverride)
$sel:includedStatistics:StatisticsConfiguration' :: StatisticsConfiguration -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"IncludedStatistics" 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 (NonEmpty Text)
includedStatistics,
            (Key
"Overrides" 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 (NonEmpty StatisticOverride)
overrides
          ]
      )