{-# 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.SageMaker.Types.IntegerParameterRangeSpecification
-- 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.SageMaker.Types.IntegerParameterRangeSpecification where

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

-- | Defines the possible values for an integer hyperparameter.
--
-- /See:/ 'newIntegerParameterRangeSpecification' smart constructor.
data IntegerParameterRangeSpecification = IntegerParameterRangeSpecification'
  { -- | The minimum integer value allowed.
    IntegerParameterRangeSpecification -> Text
minValue :: Prelude.Text,
    -- | The maximum integer value allowed.
    IntegerParameterRangeSpecification -> Text
maxValue :: Prelude.Text
  }
  deriving (IntegerParameterRangeSpecification
-> IntegerParameterRangeSpecification -> Bool
(IntegerParameterRangeSpecification
 -> IntegerParameterRangeSpecification -> Bool)
-> (IntegerParameterRangeSpecification
    -> IntegerParameterRangeSpecification -> Bool)
-> Eq IntegerParameterRangeSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntegerParameterRangeSpecification
-> IntegerParameterRangeSpecification -> Bool
$c/= :: IntegerParameterRangeSpecification
-> IntegerParameterRangeSpecification -> Bool
== :: IntegerParameterRangeSpecification
-> IntegerParameterRangeSpecification -> Bool
$c== :: IntegerParameterRangeSpecification
-> IntegerParameterRangeSpecification -> Bool
Prelude.Eq, ReadPrec [IntegerParameterRangeSpecification]
ReadPrec IntegerParameterRangeSpecification
Int -> ReadS IntegerParameterRangeSpecification
ReadS [IntegerParameterRangeSpecification]
(Int -> ReadS IntegerParameterRangeSpecification)
-> ReadS [IntegerParameterRangeSpecification]
-> ReadPrec IntegerParameterRangeSpecification
-> ReadPrec [IntegerParameterRangeSpecification]
-> Read IntegerParameterRangeSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntegerParameterRangeSpecification]
$creadListPrec :: ReadPrec [IntegerParameterRangeSpecification]
readPrec :: ReadPrec IntegerParameterRangeSpecification
$creadPrec :: ReadPrec IntegerParameterRangeSpecification
readList :: ReadS [IntegerParameterRangeSpecification]
$creadList :: ReadS [IntegerParameterRangeSpecification]
readsPrec :: Int -> ReadS IntegerParameterRangeSpecification
$creadsPrec :: Int -> ReadS IntegerParameterRangeSpecification
Prelude.Read, Int -> IntegerParameterRangeSpecification -> ShowS
[IntegerParameterRangeSpecification] -> ShowS
IntegerParameterRangeSpecification -> String
(Int -> IntegerParameterRangeSpecification -> ShowS)
-> (IntegerParameterRangeSpecification -> String)
-> ([IntegerParameterRangeSpecification] -> ShowS)
-> Show IntegerParameterRangeSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntegerParameterRangeSpecification] -> ShowS
$cshowList :: [IntegerParameterRangeSpecification] -> ShowS
show :: IntegerParameterRangeSpecification -> String
$cshow :: IntegerParameterRangeSpecification -> String
showsPrec :: Int -> IntegerParameterRangeSpecification -> ShowS
$cshowsPrec :: Int -> IntegerParameterRangeSpecification -> ShowS
Prelude.Show, (forall x.
 IntegerParameterRangeSpecification
 -> Rep IntegerParameterRangeSpecification x)
-> (forall x.
    Rep IntegerParameterRangeSpecification x
    -> IntegerParameterRangeSpecification)
-> Generic IntegerParameterRangeSpecification
forall x.
Rep IntegerParameterRangeSpecification x
-> IntegerParameterRangeSpecification
forall x.
IntegerParameterRangeSpecification
-> Rep IntegerParameterRangeSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IntegerParameterRangeSpecification x
-> IntegerParameterRangeSpecification
$cfrom :: forall x.
IntegerParameterRangeSpecification
-> Rep IntegerParameterRangeSpecification x
Prelude.Generic)

-- |
-- Create a value of 'IntegerParameterRangeSpecification' 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:
--
-- 'minValue', 'integerParameterRangeSpecification_minValue' - The minimum integer value allowed.
--
-- 'maxValue', 'integerParameterRangeSpecification_maxValue' - The maximum integer value allowed.
newIntegerParameterRangeSpecification ::
  -- | 'minValue'
  Prelude.Text ->
  -- | 'maxValue'
  Prelude.Text ->
  IntegerParameterRangeSpecification
newIntegerParameterRangeSpecification :: Text -> Text -> IntegerParameterRangeSpecification
newIntegerParameterRangeSpecification
  Text
pMinValue_
  Text
pMaxValue_ =
    IntegerParameterRangeSpecification' :: Text -> Text -> IntegerParameterRangeSpecification
IntegerParameterRangeSpecification'
      { $sel:minValue:IntegerParameterRangeSpecification' :: Text
minValue =
          Text
pMinValue_,
        $sel:maxValue:IntegerParameterRangeSpecification' :: Text
maxValue = Text
pMaxValue_
      }

-- | The minimum integer value allowed.
integerParameterRangeSpecification_minValue :: Lens.Lens' IntegerParameterRangeSpecification Prelude.Text
integerParameterRangeSpecification_minValue :: (Text -> f Text)
-> IntegerParameterRangeSpecification
-> f IntegerParameterRangeSpecification
integerParameterRangeSpecification_minValue = (IntegerParameterRangeSpecification -> Text)
-> (IntegerParameterRangeSpecification
    -> Text -> IntegerParameterRangeSpecification)
-> Lens
     IntegerParameterRangeSpecification
     IntegerParameterRangeSpecification
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRangeSpecification' {Text
minValue :: Text
$sel:minValue:IntegerParameterRangeSpecification' :: IntegerParameterRangeSpecification -> Text
minValue} -> Text
minValue) (\s :: IntegerParameterRangeSpecification
s@IntegerParameterRangeSpecification' {} Text
a -> IntegerParameterRangeSpecification
s {$sel:minValue:IntegerParameterRangeSpecification' :: Text
minValue = Text
a} :: IntegerParameterRangeSpecification)

-- | The maximum integer value allowed.
integerParameterRangeSpecification_maxValue :: Lens.Lens' IntegerParameterRangeSpecification Prelude.Text
integerParameterRangeSpecification_maxValue :: (Text -> f Text)
-> IntegerParameterRangeSpecification
-> f IntegerParameterRangeSpecification
integerParameterRangeSpecification_maxValue = (IntegerParameterRangeSpecification -> Text)
-> (IntegerParameterRangeSpecification
    -> Text -> IntegerParameterRangeSpecification)
-> Lens
     IntegerParameterRangeSpecification
     IntegerParameterRangeSpecification
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRangeSpecification' {Text
maxValue :: Text
$sel:maxValue:IntegerParameterRangeSpecification' :: IntegerParameterRangeSpecification -> Text
maxValue} -> Text
maxValue) (\s :: IntegerParameterRangeSpecification
s@IntegerParameterRangeSpecification' {} Text
a -> IntegerParameterRangeSpecification
s {$sel:maxValue:IntegerParameterRangeSpecification' :: Text
maxValue = Text
a} :: IntegerParameterRangeSpecification)

instance
  Core.FromJSON
    IntegerParameterRangeSpecification
  where
  parseJSON :: Value -> Parser IntegerParameterRangeSpecification
parseJSON =
    String
-> (Object -> Parser IntegerParameterRangeSpecification)
-> Value
-> Parser IntegerParameterRangeSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IntegerParameterRangeSpecification"
      ( \Object
x ->
          Text -> Text -> IntegerParameterRangeSpecification
IntegerParameterRangeSpecification'
            (Text -> Text -> IntegerParameterRangeSpecification)
-> Parser Text
-> Parser (Text -> IntegerParameterRangeSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MinValue")
            Parser (Text -> IntegerParameterRangeSpecification)
-> Parser Text -> Parser IntegerParameterRangeSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MaxValue")
      )

instance
  Prelude.Hashable
    IntegerParameterRangeSpecification

instance
  Prelude.NFData
    IntegerParameterRangeSpecification

instance
  Core.ToJSON
    IntegerParameterRangeSpecification
  where
  toJSON :: IntegerParameterRangeSpecification -> Value
toJSON IntegerParameterRangeSpecification' {Text
maxValue :: Text
minValue :: Text
$sel:maxValue:IntegerParameterRangeSpecification' :: IntegerParameterRangeSpecification -> Text
$sel:minValue:IntegerParameterRangeSpecification' :: IntegerParameterRangeSpecification -> Text
..} =
    [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
"MinValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
minValue),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
maxValue)
          ]
      )