{-# 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.StatisticOverride
-- 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.StatisticOverride 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

-- | Override of a particular evaluation for a profile job.
--
-- /See:/ 'newStatisticOverride' smart constructor.
data StatisticOverride = StatisticOverride'
  { -- | The name of an evaluation
    StatisticOverride -> Text
statistic :: Prelude.Text,
    -- | A map that includes overrides of an evaluation’s parameters.
    StatisticOverride -> HashMap Text Text
parameters :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (StatisticOverride -> StatisticOverride -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatisticOverride -> StatisticOverride -> Bool
$c/= :: StatisticOverride -> StatisticOverride -> Bool
== :: StatisticOverride -> StatisticOverride -> Bool
$c== :: StatisticOverride -> StatisticOverride -> Bool
Prelude.Eq, ReadPrec [StatisticOverride]
ReadPrec StatisticOverride
Int -> ReadS StatisticOverride
ReadS [StatisticOverride]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatisticOverride]
$creadListPrec :: ReadPrec [StatisticOverride]
readPrec :: ReadPrec StatisticOverride
$creadPrec :: ReadPrec StatisticOverride
readList :: ReadS [StatisticOverride]
$creadList :: ReadS [StatisticOverride]
readsPrec :: Int -> ReadS StatisticOverride
$creadsPrec :: Int -> ReadS StatisticOverride
Prelude.Read, Int -> StatisticOverride -> ShowS
[StatisticOverride] -> ShowS
StatisticOverride -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatisticOverride] -> ShowS
$cshowList :: [StatisticOverride] -> ShowS
show :: StatisticOverride -> String
$cshow :: StatisticOverride -> String
showsPrec :: Int -> StatisticOverride -> ShowS
$cshowsPrec :: Int -> StatisticOverride -> ShowS
Prelude.Show, forall x. Rep StatisticOverride x -> StatisticOverride
forall x. StatisticOverride -> Rep StatisticOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatisticOverride x -> StatisticOverride
$cfrom :: forall x. StatisticOverride -> Rep StatisticOverride x
Prelude.Generic)

-- |
-- Create a value of 'StatisticOverride' 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:
--
-- 'statistic', 'statisticOverride_statistic' - The name of an evaluation
--
-- 'parameters', 'statisticOverride_parameters' - A map that includes overrides of an evaluation’s parameters.
newStatisticOverride ::
  -- | 'statistic'
  Prelude.Text ->
  StatisticOverride
newStatisticOverride :: Text -> StatisticOverride
newStatisticOverride Text
pStatistic_ =
  StatisticOverride'
    { $sel:statistic:StatisticOverride' :: Text
statistic = Text
pStatistic_,
      $sel:parameters:StatisticOverride' :: HashMap Text Text
parameters = forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of an evaluation
statisticOverride_statistic :: Lens.Lens' StatisticOverride Prelude.Text
statisticOverride_statistic :: Lens' StatisticOverride Text
statisticOverride_statistic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticOverride' {Text
statistic :: Text
$sel:statistic:StatisticOverride' :: StatisticOverride -> Text
statistic} -> Text
statistic) (\s :: StatisticOverride
s@StatisticOverride' {} Text
a -> StatisticOverride
s {$sel:statistic:StatisticOverride' :: Text
statistic = Text
a} :: StatisticOverride)

-- | A map that includes overrides of an evaluation’s parameters.
statisticOverride_parameters :: Lens.Lens' StatisticOverride (Prelude.HashMap Prelude.Text Prelude.Text)
statisticOverride_parameters :: Lens' StatisticOverride (HashMap Text Text)
statisticOverride_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticOverride' {HashMap Text Text
parameters :: HashMap Text Text
$sel:parameters:StatisticOverride' :: StatisticOverride -> HashMap Text Text
parameters} -> HashMap Text Text
parameters) (\s :: StatisticOverride
s@StatisticOverride' {} HashMap Text Text
a -> StatisticOverride
s {$sel:parameters:StatisticOverride' :: HashMap Text Text
parameters = HashMap Text Text
a} :: StatisticOverride) 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 StatisticOverride where
  parseJSON :: Value -> Parser StatisticOverride
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StatisticOverride"
      ( \Object
x ->
          Text -> HashMap Text Text -> StatisticOverride
StatisticOverride'
            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
"Statistic")
            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
"Parameters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable StatisticOverride where
  hashWithSalt :: Int -> StatisticOverride -> Int
hashWithSalt Int
_salt StatisticOverride' {Text
HashMap Text Text
parameters :: HashMap Text Text
statistic :: Text
$sel:parameters:StatisticOverride' :: StatisticOverride -> HashMap Text Text
$sel:statistic:StatisticOverride' :: StatisticOverride -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
statistic
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Text
parameters

instance Prelude.NFData StatisticOverride where
  rnf :: StatisticOverride -> ()
rnf StatisticOverride' {Text
HashMap Text Text
parameters :: HashMap Text Text
statistic :: Text
$sel:parameters:StatisticOverride' :: StatisticOverride -> HashMap Text Text
$sel:statistic:StatisticOverride' :: StatisticOverride -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
statistic
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Text
parameters

instance Data.ToJSON StatisticOverride where
  toJSON :: StatisticOverride -> Value
toJSON StatisticOverride' {Text
HashMap Text Text
parameters :: HashMap Text Text
statistic :: Text
$sel:parameters:StatisticOverride' :: StatisticOverride -> HashMap Text Text
$sel:statistic:StatisticOverride' :: StatisticOverride -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Statistic" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
statistic),
            forall a. a -> Maybe a
Prelude.Just (Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text Text
parameters)
          ]
      )