{-# 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.Personalize.Types.DefaultIntegerHyperParameterRange
-- 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.Personalize.Types.DefaultIntegerHyperParameterRange where

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

-- | Provides the name and default range of a integer-valued hyperparameter
-- and whether the hyperparameter is tunable. A tunable hyperparameter can
-- have its value determined during hyperparameter optimization (HPO).
--
-- /See:/ 'newDefaultIntegerHyperParameterRange' smart constructor.
data DefaultIntegerHyperParameterRange = DefaultIntegerHyperParameterRange'
  { -- | The maximum allowable value for the hyperparameter.
    DefaultIntegerHyperParameterRange -> Maybe Int
maxValue :: Prelude.Maybe Prelude.Int,
    -- | Indicates whether the hyperparameter is tunable.
    DefaultIntegerHyperParameterRange -> Maybe Bool
isTunable :: Prelude.Maybe Prelude.Bool,
    -- | The name of the hyperparameter.
    DefaultIntegerHyperParameterRange -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The minimum allowable value for the hyperparameter.
    DefaultIntegerHyperParameterRange -> Maybe Int
minValue :: Prelude.Maybe Prelude.Int
  }
  deriving (DefaultIntegerHyperParameterRange
-> DefaultIntegerHyperParameterRange -> Bool
(DefaultIntegerHyperParameterRange
 -> DefaultIntegerHyperParameterRange -> Bool)
-> (DefaultIntegerHyperParameterRange
    -> DefaultIntegerHyperParameterRange -> Bool)
-> Eq DefaultIntegerHyperParameterRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultIntegerHyperParameterRange
-> DefaultIntegerHyperParameterRange -> Bool
$c/= :: DefaultIntegerHyperParameterRange
-> DefaultIntegerHyperParameterRange -> Bool
== :: DefaultIntegerHyperParameterRange
-> DefaultIntegerHyperParameterRange -> Bool
$c== :: DefaultIntegerHyperParameterRange
-> DefaultIntegerHyperParameterRange -> Bool
Prelude.Eq, ReadPrec [DefaultIntegerHyperParameterRange]
ReadPrec DefaultIntegerHyperParameterRange
Int -> ReadS DefaultIntegerHyperParameterRange
ReadS [DefaultIntegerHyperParameterRange]
(Int -> ReadS DefaultIntegerHyperParameterRange)
-> ReadS [DefaultIntegerHyperParameterRange]
-> ReadPrec DefaultIntegerHyperParameterRange
-> ReadPrec [DefaultIntegerHyperParameterRange]
-> Read DefaultIntegerHyperParameterRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultIntegerHyperParameterRange]
$creadListPrec :: ReadPrec [DefaultIntegerHyperParameterRange]
readPrec :: ReadPrec DefaultIntegerHyperParameterRange
$creadPrec :: ReadPrec DefaultIntegerHyperParameterRange
readList :: ReadS [DefaultIntegerHyperParameterRange]
$creadList :: ReadS [DefaultIntegerHyperParameterRange]
readsPrec :: Int -> ReadS DefaultIntegerHyperParameterRange
$creadsPrec :: Int -> ReadS DefaultIntegerHyperParameterRange
Prelude.Read, Int -> DefaultIntegerHyperParameterRange -> ShowS
[DefaultIntegerHyperParameterRange] -> ShowS
DefaultIntegerHyperParameterRange -> String
(Int -> DefaultIntegerHyperParameterRange -> ShowS)
-> (DefaultIntegerHyperParameterRange -> String)
-> ([DefaultIntegerHyperParameterRange] -> ShowS)
-> Show DefaultIntegerHyperParameterRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultIntegerHyperParameterRange] -> ShowS
$cshowList :: [DefaultIntegerHyperParameterRange] -> ShowS
show :: DefaultIntegerHyperParameterRange -> String
$cshow :: DefaultIntegerHyperParameterRange -> String
showsPrec :: Int -> DefaultIntegerHyperParameterRange -> ShowS
$cshowsPrec :: Int -> DefaultIntegerHyperParameterRange -> ShowS
Prelude.Show, (forall x.
 DefaultIntegerHyperParameterRange
 -> Rep DefaultIntegerHyperParameterRange x)
-> (forall x.
    Rep DefaultIntegerHyperParameterRange x
    -> DefaultIntegerHyperParameterRange)
-> Generic DefaultIntegerHyperParameterRange
forall x.
Rep DefaultIntegerHyperParameterRange x
-> DefaultIntegerHyperParameterRange
forall x.
DefaultIntegerHyperParameterRange
-> Rep DefaultIntegerHyperParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultIntegerHyperParameterRange x
-> DefaultIntegerHyperParameterRange
$cfrom :: forall x.
DefaultIntegerHyperParameterRange
-> Rep DefaultIntegerHyperParameterRange x
Prelude.Generic)

-- |
-- Create a value of 'DefaultIntegerHyperParameterRange' 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:
--
-- 'maxValue', 'defaultIntegerHyperParameterRange_maxValue' - The maximum allowable value for the hyperparameter.
--
-- 'isTunable', 'defaultIntegerHyperParameterRange_isTunable' - Indicates whether the hyperparameter is tunable.
--
-- 'name', 'defaultIntegerHyperParameterRange_name' - The name of the hyperparameter.
--
-- 'minValue', 'defaultIntegerHyperParameterRange_minValue' - The minimum allowable value for the hyperparameter.
newDefaultIntegerHyperParameterRange ::
  DefaultIntegerHyperParameterRange
newDefaultIntegerHyperParameterRange :: DefaultIntegerHyperParameterRange
newDefaultIntegerHyperParameterRange =
  DefaultIntegerHyperParameterRange' :: Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> DefaultIntegerHyperParameterRange
DefaultIntegerHyperParameterRange'
    { $sel:maxValue:DefaultIntegerHyperParameterRange' :: Maybe Int
maxValue =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:isTunable:DefaultIntegerHyperParameterRange' :: Maybe Bool
isTunable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DefaultIntegerHyperParameterRange' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:minValue:DefaultIntegerHyperParameterRange' :: Maybe Int
minValue = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum allowable value for the hyperparameter.
defaultIntegerHyperParameterRange_maxValue :: Lens.Lens' DefaultIntegerHyperParameterRange (Prelude.Maybe Prelude.Int)
defaultIntegerHyperParameterRange_maxValue :: (Maybe Int -> f (Maybe Int))
-> DefaultIntegerHyperParameterRange
-> f DefaultIntegerHyperParameterRange
defaultIntegerHyperParameterRange_maxValue = (DefaultIntegerHyperParameterRange -> Maybe Int)
-> (DefaultIntegerHyperParameterRange
    -> Maybe Int -> DefaultIntegerHyperParameterRange)
-> Lens
     DefaultIntegerHyperParameterRange
     DefaultIntegerHyperParameterRange
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultIntegerHyperParameterRange' {Maybe Int
maxValue :: Maybe Int
$sel:maxValue:DefaultIntegerHyperParameterRange' :: DefaultIntegerHyperParameterRange -> Maybe Int
maxValue} -> Maybe Int
maxValue) (\s :: DefaultIntegerHyperParameterRange
s@DefaultIntegerHyperParameterRange' {} Maybe Int
a -> DefaultIntegerHyperParameterRange
s {$sel:maxValue:DefaultIntegerHyperParameterRange' :: Maybe Int
maxValue = Maybe Int
a} :: DefaultIntegerHyperParameterRange)

-- | Indicates whether the hyperparameter is tunable.
defaultIntegerHyperParameterRange_isTunable :: Lens.Lens' DefaultIntegerHyperParameterRange (Prelude.Maybe Prelude.Bool)
defaultIntegerHyperParameterRange_isTunable :: (Maybe Bool -> f (Maybe Bool))
-> DefaultIntegerHyperParameterRange
-> f DefaultIntegerHyperParameterRange
defaultIntegerHyperParameterRange_isTunable = (DefaultIntegerHyperParameterRange -> Maybe Bool)
-> (DefaultIntegerHyperParameterRange
    -> Maybe Bool -> DefaultIntegerHyperParameterRange)
-> Lens
     DefaultIntegerHyperParameterRange
     DefaultIntegerHyperParameterRange
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultIntegerHyperParameterRange' {Maybe Bool
isTunable :: Maybe Bool
$sel:isTunable:DefaultIntegerHyperParameterRange' :: DefaultIntegerHyperParameterRange -> Maybe Bool
isTunable} -> Maybe Bool
isTunable) (\s :: DefaultIntegerHyperParameterRange
s@DefaultIntegerHyperParameterRange' {} Maybe Bool
a -> DefaultIntegerHyperParameterRange
s {$sel:isTunable:DefaultIntegerHyperParameterRange' :: Maybe Bool
isTunable = Maybe Bool
a} :: DefaultIntegerHyperParameterRange)

-- | The name of the hyperparameter.
defaultIntegerHyperParameterRange_name :: Lens.Lens' DefaultIntegerHyperParameterRange (Prelude.Maybe Prelude.Text)
defaultIntegerHyperParameterRange_name :: (Maybe Text -> f (Maybe Text))
-> DefaultIntegerHyperParameterRange
-> f DefaultIntegerHyperParameterRange
defaultIntegerHyperParameterRange_name = (DefaultIntegerHyperParameterRange -> Maybe Text)
-> (DefaultIntegerHyperParameterRange
    -> Maybe Text -> DefaultIntegerHyperParameterRange)
-> Lens
     DefaultIntegerHyperParameterRange
     DefaultIntegerHyperParameterRange
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultIntegerHyperParameterRange' {Maybe Text
name :: Maybe Text
$sel:name:DefaultIntegerHyperParameterRange' :: DefaultIntegerHyperParameterRange -> Maybe Text
name} -> Maybe Text
name) (\s :: DefaultIntegerHyperParameterRange
s@DefaultIntegerHyperParameterRange' {} Maybe Text
a -> DefaultIntegerHyperParameterRange
s {$sel:name:DefaultIntegerHyperParameterRange' :: Maybe Text
name = Maybe Text
a} :: DefaultIntegerHyperParameterRange)

-- | The minimum allowable value for the hyperparameter.
defaultIntegerHyperParameterRange_minValue :: Lens.Lens' DefaultIntegerHyperParameterRange (Prelude.Maybe Prelude.Int)
defaultIntegerHyperParameterRange_minValue :: (Maybe Int -> f (Maybe Int))
-> DefaultIntegerHyperParameterRange
-> f DefaultIntegerHyperParameterRange
defaultIntegerHyperParameterRange_minValue = (DefaultIntegerHyperParameterRange -> Maybe Int)
-> (DefaultIntegerHyperParameterRange
    -> Maybe Int -> DefaultIntegerHyperParameterRange)
-> Lens
     DefaultIntegerHyperParameterRange
     DefaultIntegerHyperParameterRange
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultIntegerHyperParameterRange' {Maybe Int
minValue :: Maybe Int
$sel:minValue:DefaultIntegerHyperParameterRange' :: DefaultIntegerHyperParameterRange -> Maybe Int
minValue} -> Maybe Int
minValue) (\s :: DefaultIntegerHyperParameterRange
s@DefaultIntegerHyperParameterRange' {} Maybe Int
a -> DefaultIntegerHyperParameterRange
s {$sel:minValue:DefaultIntegerHyperParameterRange' :: Maybe Int
minValue = Maybe Int
a} :: DefaultIntegerHyperParameterRange)

instance
  Core.FromJSON
    DefaultIntegerHyperParameterRange
  where
  parseJSON :: Value -> Parser DefaultIntegerHyperParameterRange
parseJSON =
    String
-> (Object -> Parser DefaultIntegerHyperParameterRange)
-> Value
-> Parser DefaultIntegerHyperParameterRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DefaultIntegerHyperParameterRange"
      ( \Object
x ->
          Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> DefaultIntegerHyperParameterRange
DefaultIntegerHyperParameterRange'
            (Maybe Int
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Int
 -> DefaultIntegerHyperParameterRange)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe Text -> Maybe Int -> DefaultIntegerHyperParameterRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maxValue")
            Parser
  (Maybe Bool
   -> Maybe Text -> Maybe Int -> DefaultIntegerHyperParameterRange)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Maybe Int -> DefaultIntegerHyperParameterRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isTunable")
            Parser
  (Maybe Text -> Maybe Int -> DefaultIntegerHyperParameterRange)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> DefaultIntegerHyperParameterRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Int -> DefaultIntegerHyperParameterRange)
-> Parser (Maybe Int) -> Parser DefaultIntegerHyperParameterRange
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minValue")
      )

instance
  Prelude.Hashable
    DefaultIntegerHyperParameterRange

instance
  Prelude.NFData
    DefaultIntegerHyperParameterRange