{-# 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.DefaultCategoricalHyperParameterRange
-- 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.DefaultCategoricalHyperParameterRange 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 categorical hyperparameter and
-- whether the hyperparameter is tunable. A tunable hyperparameter can have
-- its value determined during hyperparameter optimization (HPO).
--
-- /See:/ 'newDefaultCategoricalHyperParameterRange' smart constructor.
data DefaultCategoricalHyperParameterRange = DefaultCategoricalHyperParameterRange'
  { -- | Whether the hyperparameter is tunable.
    DefaultCategoricalHyperParameterRange -> Maybe Bool
isTunable :: Prelude.Maybe Prelude.Bool,
    -- | A list of the categories for the hyperparameter.
    DefaultCategoricalHyperParameterRange -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text],
    -- | The name of the hyperparameter.
    DefaultCategoricalHyperParameterRange -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (DefaultCategoricalHyperParameterRange
-> DefaultCategoricalHyperParameterRange -> Bool
(DefaultCategoricalHyperParameterRange
 -> DefaultCategoricalHyperParameterRange -> Bool)
-> (DefaultCategoricalHyperParameterRange
    -> DefaultCategoricalHyperParameterRange -> Bool)
-> Eq DefaultCategoricalHyperParameterRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultCategoricalHyperParameterRange
-> DefaultCategoricalHyperParameterRange -> Bool
$c/= :: DefaultCategoricalHyperParameterRange
-> DefaultCategoricalHyperParameterRange -> Bool
== :: DefaultCategoricalHyperParameterRange
-> DefaultCategoricalHyperParameterRange -> Bool
$c== :: DefaultCategoricalHyperParameterRange
-> DefaultCategoricalHyperParameterRange -> Bool
Prelude.Eq, ReadPrec [DefaultCategoricalHyperParameterRange]
ReadPrec DefaultCategoricalHyperParameterRange
Int -> ReadS DefaultCategoricalHyperParameterRange
ReadS [DefaultCategoricalHyperParameterRange]
(Int -> ReadS DefaultCategoricalHyperParameterRange)
-> ReadS [DefaultCategoricalHyperParameterRange]
-> ReadPrec DefaultCategoricalHyperParameterRange
-> ReadPrec [DefaultCategoricalHyperParameterRange]
-> Read DefaultCategoricalHyperParameterRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultCategoricalHyperParameterRange]
$creadListPrec :: ReadPrec [DefaultCategoricalHyperParameterRange]
readPrec :: ReadPrec DefaultCategoricalHyperParameterRange
$creadPrec :: ReadPrec DefaultCategoricalHyperParameterRange
readList :: ReadS [DefaultCategoricalHyperParameterRange]
$creadList :: ReadS [DefaultCategoricalHyperParameterRange]
readsPrec :: Int -> ReadS DefaultCategoricalHyperParameterRange
$creadsPrec :: Int -> ReadS DefaultCategoricalHyperParameterRange
Prelude.Read, Int -> DefaultCategoricalHyperParameterRange -> ShowS
[DefaultCategoricalHyperParameterRange] -> ShowS
DefaultCategoricalHyperParameterRange -> String
(Int -> DefaultCategoricalHyperParameterRange -> ShowS)
-> (DefaultCategoricalHyperParameterRange -> String)
-> ([DefaultCategoricalHyperParameterRange] -> ShowS)
-> Show DefaultCategoricalHyperParameterRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultCategoricalHyperParameterRange] -> ShowS
$cshowList :: [DefaultCategoricalHyperParameterRange] -> ShowS
show :: DefaultCategoricalHyperParameterRange -> String
$cshow :: DefaultCategoricalHyperParameterRange -> String
showsPrec :: Int -> DefaultCategoricalHyperParameterRange -> ShowS
$cshowsPrec :: Int -> DefaultCategoricalHyperParameterRange -> ShowS
Prelude.Show, (forall x.
 DefaultCategoricalHyperParameterRange
 -> Rep DefaultCategoricalHyperParameterRange x)
-> (forall x.
    Rep DefaultCategoricalHyperParameterRange x
    -> DefaultCategoricalHyperParameterRange)
-> Generic DefaultCategoricalHyperParameterRange
forall x.
Rep DefaultCategoricalHyperParameterRange x
-> DefaultCategoricalHyperParameterRange
forall x.
DefaultCategoricalHyperParameterRange
-> Rep DefaultCategoricalHyperParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultCategoricalHyperParameterRange x
-> DefaultCategoricalHyperParameterRange
$cfrom :: forall x.
DefaultCategoricalHyperParameterRange
-> Rep DefaultCategoricalHyperParameterRange x
Prelude.Generic)

-- |
-- Create a value of 'DefaultCategoricalHyperParameterRange' 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:
--
-- 'isTunable', 'defaultCategoricalHyperParameterRange_isTunable' - Whether the hyperparameter is tunable.
--
-- 'values', 'defaultCategoricalHyperParameterRange_values' - A list of the categories for the hyperparameter.
--
-- 'name', 'defaultCategoricalHyperParameterRange_name' - The name of the hyperparameter.
newDefaultCategoricalHyperParameterRange ::
  DefaultCategoricalHyperParameterRange
newDefaultCategoricalHyperParameterRange :: DefaultCategoricalHyperParameterRange
newDefaultCategoricalHyperParameterRange =
  DefaultCategoricalHyperParameterRange' :: Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> DefaultCategoricalHyperParameterRange
DefaultCategoricalHyperParameterRange'
    { $sel:isTunable:DefaultCategoricalHyperParameterRange' :: Maybe Bool
isTunable =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:values:DefaultCategoricalHyperParameterRange' :: Maybe [Text]
values = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DefaultCategoricalHyperParameterRange' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | A list of the categories for the hyperparameter.
defaultCategoricalHyperParameterRange_values :: Lens.Lens' DefaultCategoricalHyperParameterRange (Prelude.Maybe [Prelude.Text])
defaultCategoricalHyperParameterRange_values :: (Maybe [Text] -> f (Maybe [Text]))
-> DefaultCategoricalHyperParameterRange
-> f DefaultCategoricalHyperParameterRange
defaultCategoricalHyperParameterRange_values = (DefaultCategoricalHyperParameterRange -> Maybe [Text])
-> (DefaultCategoricalHyperParameterRange
    -> Maybe [Text] -> DefaultCategoricalHyperParameterRange)
-> Lens
     DefaultCategoricalHyperParameterRange
     DefaultCategoricalHyperParameterRange
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultCategoricalHyperParameterRange' {Maybe [Text]
values :: Maybe [Text]
$sel:values:DefaultCategoricalHyperParameterRange' :: DefaultCategoricalHyperParameterRange -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: DefaultCategoricalHyperParameterRange
s@DefaultCategoricalHyperParameterRange' {} Maybe [Text]
a -> DefaultCategoricalHyperParameterRange
s {$sel:values:DefaultCategoricalHyperParameterRange' :: Maybe [Text]
values = Maybe [Text]
a} :: DefaultCategoricalHyperParameterRange) ((Maybe [Text] -> f (Maybe [Text]))
 -> DefaultCategoricalHyperParameterRange
 -> f DefaultCategoricalHyperParameterRange)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DefaultCategoricalHyperParameterRange
-> f DefaultCategoricalHyperParameterRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Core.FromJSON
    DefaultCategoricalHyperParameterRange
  where
  parseJSON :: Value -> Parser DefaultCategoricalHyperParameterRange
parseJSON =
    String
-> (Object -> Parser DefaultCategoricalHyperParameterRange)
-> Value
-> Parser DefaultCategoricalHyperParameterRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DefaultCategoricalHyperParameterRange"
      ( \Object
x ->
          Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> DefaultCategoricalHyperParameterRange
DefaultCategoricalHyperParameterRange'
            (Maybe Bool
 -> Maybe [Text]
 -> Maybe Text
 -> DefaultCategoricalHyperParameterRange)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text]
      -> Maybe Text -> DefaultCategoricalHyperParameterRange)
forall (f :: * -> *) a b. Functor 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 Text -> DefaultCategoricalHyperParameterRange)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> DefaultCategoricalHyperParameterRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"values" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> DefaultCategoricalHyperParameterRange)
-> Parser (Maybe Text)
-> Parser DefaultCategoricalHyperParameterRange
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")
      )

instance
  Prelude.Hashable
    DefaultCategoricalHyperParameterRange

instance
  Prelude.NFData
    DefaultCategoricalHyperParameterRange