{-# 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 #-}
module Amazonka.Forecast.Types.ContinuousParameterRange where
import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.ScalingType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ContinuousParameterRange = ContinuousParameterRange'
{
ContinuousParameterRange -> Maybe ScalingType
scalingType :: Prelude.Maybe ScalingType,
ContinuousParameterRange -> Text
name :: Prelude.Text,
ContinuousParameterRange -> Double
maxValue :: Prelude.Double,
ContinuousParameterRange -> Double
minValue :: Prelude.Double
}
deriving (ContinuousParameterRange -> ContinuousParameterRange -> Bool
(ContinuousParameterRange -> ContinuousParameterRange -> Bool)
-> (ContinuousParameterRange -> ContinuousParameterRange -> Bool)
-> Eq ContinuousParameterRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinuousParameterRange -> ContinuousParameterRange -> Bool
$c/= :: ContinuousParameterRange -> ContinuousParameterRange -> Bool
== :: ContinuousParameterRange -> ContinuousParameterRange -> Bool
$c== :: ContinuousParameterRange -> ContinuousParameterRange -> Bool
Prelude.Eq, ReadPrec [ContinuousParameterRange]
ReadPrec ContinuousParameterRange
Int -> ReadS ContinuousParameterRange
ReadS [ContinuousParameterRange]
(Int -> ReadS ContinuousParameterRange)
-> ReadS [ContinuousParameterRange]
-> ReadPrec ContinuousParameterRange
-> ReadPrec [ContinuousParameterRange]
-> Read ContinuousParameterRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinuousParameterRange]
$creadListPrec :: ReadPrec [ContinuousParameterRange]
readPrec :: ReadPrec ContinuousParameterRange
$creadPrec :: ReadPrec ContinuousParameterRange
readList :: ReadS [ContinuousParameterRange]
$creadList :: ReadS [ContinuousParameterRange]
readsPrec :: Int -> ReadS ContinuousParameterRange
$creadsPrec :: Int -> ReadS ContinuousParameterRange
Prelude.Read, Int -> ContinuousParameterRange -> ShowS
[ContinuousParameterRange] -> ShowS
ContinuousParameterRange -> String
(Int -> ContinuousParameterRange -> ShowS)
-> (ContinuousParameterRange -> String)
-> ([ContinuousParameterRange] -> ShowS)
-> Show ContinuousParameterRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinuousParameterRange] -> ShowS
$cshowList :: [ContinuousParameterRange] -> ShowS
show :: ContinuousParameterRange -> String
$cshow :: ContinuousParameterRange -> String
showsPrec :: Int -> ContinuousParameterRange -> ShowS
$cshowsPrec :: Int -> ContinuousParameterRange -> ShowS
Prelude.Show, (forall x.
ContinuousParameterRange -> Rep ContinuousParameterRange x)
-> (forall x.
Rep ContinuousParameterRange x -> ContinuousParameterRange)
-> Generic ContinuousParameterRange
forall x.
Rep ContinuousParameterRange x -> ContinuousParameterRange
forall x.
ContinuousParameterRange -> Rep ContinuousParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContinuousParameterRange x -> ContinuousParameterRange
$cfrom :: forall x.
ContinuousParameterRange -> Rep ContinuousParameterRange x
Prelude.Generic)
newContinuousParameterRange ::
Prelude.Text ->
Prelude.Double ->
Prelude.Double ->
ContinuousParameterRange
newContinuousParameterRange :: Text -> Double -> Double -> ContinuousParameterRange
newContinuousParameterRange
Text
pName_
Double
pMaxValue_
Double
pMinValue_ =
ContinuousParameterRange' :: Maybe ScalingType
-> Text -> Double -> Double -> ContinuousParameterRange
ContinuousParameterRange'
{ $sel:scalingType:ContinuousParameterRange' :: Maybe ScalingType
scalingType =
Maybe ScalingType
forall a. Maybe a
Prelude.Nothing,
$sel:name:ContinuousParameterRange' :: Text
name = Text
pName_,
$sel:maxValue:ContinuousParameterRange' :: Double
maxValue = Double
pMaxValue_,
$sel:minValue:ContinuousParameterRange' :: Double
minValue = Double
pMinValue_
}
continuousParameterRange_scalingType :: Lens.Lens' ContinuousParameterRange (Prelude.Maybe ScalingType)
continuousParameterRange_scalingType :: (Maybe ScalingType -> f (Maybe ScalingType))
-> ContinuousParameterRange -> f ContinuousParameterRange
continuousParameterRange_scalingType = (ContinuousParameterRange -> Maybe ScalingType)
-> (ContinuousParameterRange
-> Maybe ScalingType -> ContinuousParameterRange)
-> Lens
ContinuousParameterRange
ContinuousParameterRange
(Maybe ScalingType)
(Maybe ScalingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRange' {Maybe ScalingType
scalingType :: Maybe ScalingType
$sel:scalingType:ContinuousParameterRange' :: ContinuousParameterRange -> Maybe ScalingType
scalingType} -> Maybe ScalingType
scalingType) (\s :: ContinuousParameterRange
s@ContinuousParameterRange' {} Maybe ScalingType
a -> ContinuousParameterRange
s {$sel:scalingType:ContinuousParameterRange' :: Maybe ScalingType
scalingType = Maybe ScalingType
a} :: ContinuousParameterRange)
continuousParameterRange_name :: Lens.Lens' ContinuousParameterRange Prelude.Text
continuousParameterRange_name :: (Text -> f Text)
-> ContinuousParameterRange -> f ContinuousParameterRange
continuousParameterRange_name = (ContinuousParameterRange -> Text)
-> (ContinuousParameterRange -> Text -> ContinuousParameterRange)
-> Lens ContinuousParameterRange ContinuousParameterRange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRange' {Text
name :: Text
$sel:name:ContinuousParameterRange' :: ContinuousParameterRange -> Text
name} -> Text
name) (\s :: ContinuousParameterRange
s@ContinuousParameterRange' {} Text
a -> ContinuousParameterRange
s {$sel:name:ContinuousParameterRange' :: Text
name = Text
a} :: ContinuousParameterRange)
continuousParameterRange_maxValue :: Lens.Lens' ContinuousParameterRange Prelude.Double
continuousParameterRange_maxValue :: (Double -> f Double)
-> ContinuousParameterRange -> f ContinuousParameterRange
continuousParameterRange_maxValue = (ContinuousParameterRange -> Double)
-> (ContinuousParameterRange -> Double -> ContinuousParameterRange)
-> Lens
ContinuousParameterRange ContinuousParameterRange Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRange' {Double
maxValue :: Double
$sel:maxValue:ContinuousParameterRange' :: ContinuousParameterRange -> Double
maxValue} -> Double
maxValue) (\s :: ContinuousParameterRange
s@ContinuousParameterRange' {} Double
a -> ContinuousParameterRange
s {$sel:maxValue:ContinuousParameterRange' :: Double
maxValue = Double
a} :: ContinuousParameterRange)
continuousParameterRange_minValue :: Lens.Lens' ContinuousParameterRange Prelude.Double
continuousParameterRange_minValue :: (Double -> f Double)
-> ContinuousParameterRange -> f ContinuousParameterRange
continuousParameterRange_minValue = (ContinuousParameterRange -> Double)
-> (ContinuousParameterRange -> Double -> ContinuousParameterRange)
-> Lens
ContinuousParameterRange ContinuousParameterRange Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRange' {Double
minValue :: Double
$sel:minValue:ContinuousParameterRange' :: ContinuousParameterRange -> Double
minValue} -> Double
minValue) (\s :: ContinuousParameterRange
s@ContinuousParameterRange' {} Double
a -> ContinuousParameterRange
s {$sel:minValue:ContinuousParameterRange' :: Double
minValue = Double
a} :: ContinuousParameterRange)
instance Core.FromJSON ContinuousParameterRange where
parseJSON :: Value -> Parser ContinuousParameterRange
parseJSON =
String
-> (Object -> Parser ContinuousParameterRange)
-> Value
-> Parser ContinuousParameterRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ContinuousParameterRange"
( \Object
x ->
Maybe ScalingType
-> Text -> Double -> Double -> ContinuousParameterRange
ContinuousParameterRange'
(Maybe ScalingType
-> Text -> Double -> Double -> ContinuousParameterRange)
-> Parser (Maybe ScalingType)
-> Parser (Text -> Double -> Double -> ContinuousParameterRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScalingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingType")
Parser (Text -> Double -> Double -> ContinuousParameterRange)
-> Parser Text
-> Parser (Double -> Double -> ContinuousParameterRange)
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
"Name")
Parser (Double -> Double -> ContinuousParameterRange)
-> Parser Double -> Parser (Double -> ContinuousParameterRange)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MaxValue")
Parser (Double -> ContinuousParameterRange)
-> Parser Double -> Parser ContinuousParameterRange
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MinValue")
)
instance Prelude.Hashable ContinuousParameterRange
instance Prelude.NFData ContinuousParameterRange
instance Core.ToJSON ContinuousParameterRange where
toJSON :: ContinuousParameterRange -> Value
toJSON ContinuousParameterRange' {Double
Maybe ScalingType
Text
minValue :: Double
maxValue :: Double
name :: Text
scalingType :: Maybe ScalingType
$sel:minValue:ContinuousParameterRange' :: ContinuousParameterRange -> Double
$sel:maxValue:ContinuousParameterRange' :: ContinuousParameterRange -> Double
$sel:name:ContinuousParameterRange' :: ContinuousParameterRange -> Text
$sel:scalingType:ContinuousParameterRange' :: ContinuousParameterRange -> Maybe ScalingType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ScalingType" Text -> ScalingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScalingType -> Pair) -> Maybe ScalingType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScalingType
scalingType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxValue" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
maxValue),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MinValue" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
minValue)
]
)