{-# 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.FeaturizationConfig where
import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.Featurization
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FeaturizationConfig = FeaturizationConfig'
{
FeaturizationConfig -> Maybe (NonEmpty Featurization)
featurizations :: Prelude.Maybe (Prelude.NonEmpty Featurization),
FeaturizationConfig -> Maybe (NonEmpty Text)
forecastDimensions :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
FeaturizationConfig -> Text
forecastFrequency :: Prelude.Text
}
deriving (FeaturizationConfig -> FeaturizationConfig -> Bool
(FeaturizationConfig -> FeaturizationConfig -> Bool)
-> (FeaturizationConfig -> FeaturizationConfig -> Bool)
-> Eq FeaturizationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FeaturizationConfig -> FeaturizationConfig -> Bool
$c/= :: FeaturizationConfig -> FeaturizationConfig -> Bool
== :: FeaturizationConfig -> FeaturizationConfig -> Bool
$c== :: FeaturizationConfig -> FeaturizationConfig -> Bool
Prelude.Eq, ReadPrec [FeaturizationConfig]
ReadPrec FeaturizationConfig
Int -> ReadS FeaturizationConfig
ReadS [FeaturizationConfig]
(Int -> ReadS FeaturizationConfig)
-> ReadS [FeaturizationConfig]
-> ReadPrec FeaturizationConfig
-> ReadPrec [FeaturizationConfig]
-> Read FeaturizationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FeaturizationConfig]
$creadListPrec :: ReadPrec [FeaturizationConfig]
readPrec :: ReadPrec FeaturizationConfig
$creadPrec :: ReadPrec FeaturizationConfig
readList :: ReadS [FeaturizationConfig]
$creadList :: ReadS [FeaturizationConfig]
readsPrec :: Int -> ReadS FeaturizationConfig
$creadsPrec :: Int -> ReadS FeaturizationConfig
Prelude.Read, Int -> FeaturizationConfig -> ShowS
[FeaturizationConfig] -> ShowS
FeaturizationConfig -> String
(Int -> FeaturizationConfig -> ShowS)
-> (FeaturizationConfig -> String)
-> ([FeaturizationConfig] -> ShowS)
-> Show FeaturizationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FeaturizationConfig] -> ShowS
$cshowList :: [FeaturizationConfig] -> ShowS
show :: FeaturizationConfig -> String
$cshow :: FeaturizationConfig -> String
showsPrec :: Int -> FeaturizationConfig -> ShowS
$cshowsPrec :: Int -> FeaturizationConfig -> ShowS
Prelude.Show, (forall x. FeaturizationConfig -> Rep FeaturizationConfig x)
-> (forall x. Rep FeaturizationConfig x -> FeaturizationConfig)
-> Generic FeaturizationConfig
forall x. Rep FeaturizationConfig x -> FeaturizationConfig
forall x. FeaturizationConfig -> Rep FeaturizationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FeaturizationConfig x -> FeaturizationConfig
$cfrom :: forall x. FeaturizationConfig -> Rep FeaturizationConfig x
Prelude.Generic)
newFeaturizationConfig ::
Prelude.Text ->
FeaturizationConfig
newFeaturizationConfig :: Text -> FeaturizationConfig
newFeaturizationConfig Text
pForecastFrequency_ =
FeaturizationConfig' :: Maybe (NonEmpty Featurization)
-> Maybe (NonEmpty Text) -> Text -> FeaturizationConfig
FeaturizationConfig'
{ $sel:featurizations:FeaturizationConfig' :: Maybe (NonEmpty Featurization)
featurizations =
Maybe (NonEmpty Featurization)
forall a. Maybe a
Prelude.Nothing,
$sel:forecastDimensions:FeaturizationConfig' :: Maybe (NonEmpty Text)
forecastDimensions = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:forecastFrequency:FeaturizationConfig' :: Text
forecastFrequency = Text
pForecastFrequency_
}
featurizationConfig_featurizations :: Lens.Lens' FeaturizationConfig (Prelude.Maybe (Prelude.NonEmpty Featurization))
featurizationConfig_featurizations :: (Maybe (NonEmpty Featurization)
-> f (Maybe (NonEmpty Featurization)))
-> FeaturizationConfig -> f FeaturizationConfig
featurizationConfig_featurizations = (FeaturizationConfig -> Maybe (NonEmpty Featurization))
-> (FeaturizationConfig
-> Maybe (NonEmpty Featurization) -> FeaturizationConfig)
-> Lens
FeaturizationConfig
FeaturizationConfig
(Maybe (NonEmpty Featurization))
(Maybe (NonEmpty Featurization))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeaturizationConfig' {Maybe (NonEmpty Featurization)
featurizations :: Maybe (NonEmpty Featurization)
$sel:featurizations:FeaturizationConfig' :: FeaturizationConfig -> Maybe (NonEmpty Featurization)
featurizations} -> Maybe (NonEmpty Featurization)
featurizations) (\s :: FeaturizationConfig
s@FeaturizationConfig' {} Maybe (NonEmpty Featurization)
a -> FeaturizationConfig
s {$sel:featurizations:FeaturizationConfig' :: Maybe (NonEmpty Featurization)
featurizations = Maybe (NonEmpty Featurization)
a} :: FeaturizationConfig) ((Maybe (NonEmpty Featurization)
-> f (Maybe (NonEmpty Featurization)))
-> FeaturizationConfig -> f FeaturizationConfig)
-> ((Maybe (NonEmpty Featurization)
-> f (Maybe (NonEmpty Featurization)))
-> Maybe (NonEmpty Featurization)
-> f (Maybe (NonEmpty Featurization)))
-> (Maybe (NonEmpty Featurization)
-> f (Maybe (NonEmpty Featurization)))
-> FeaturizationConfig
-> f FeaturizationConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Featurization)
(NonEmpty Featurization)
(NonEmpty Featurization)
(NonEmpty Featurization)
-> Iso
(Maybe (NonEmpty Featurization))
(Maybe (NonEmpty Featurization))
(Maybe (NonEmpty Featurization))
(Maybe (NonEmpty Featurization))
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
(NonEmpty Featurization)
(NonEmpty Featurization)
(NonEmpty Featurization)
(NonEmpty Featurization)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
featurizationConfig_forecastDimensions :: Lens.Lens' FeaturizationConfig (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
featurizationConfig_forecastDimensions :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> FeaturizationConfig -> f FeaturizationConfig
featurizationConfig_forecastDimensions = (FeaturizationConfig -> Maybe (NonEmpty Text))
-> (FeaturizationConfig
-> Maybe (NonEmpty Text) -> FeaturizationConfig)
-> Lens
FeaturizationConfig
FeaturizationConfig
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeaturizationConfig' {Maybe (NonEmpty Text)
forecastDimensions :: Maybe (NonEmpty Text)
$sel:forecastDimensions:FeaturizationConfig' :: FeaturizationConfig -> Maybe (NonEmpty Text)
forecastDimensions} -> Maybe (NonEmpty Text)
forecastDimensions) (\s :: FeaturizationConfig
s@FeaturizationConfig' {} Maybe (NonEmpty Text)
a -> FeaturizationConfig
s {$sel:forecastDimensions:FeaturizationConfig' :: Maybe (NonEmpty Text)
forecastDimensions = Maybe (NonEmpty Text)
a} :: FeaturizationConfig) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> FeaturizationConfig -> f FeaturizationConfig)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> FeaturizationConfig
-> f FeaturizationConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty 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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
featurizationConfig_forecastFrequency :: Lens.Lens' FeaturizationConfig Prelude.Text
featurizationConfig_forecastFrequency :: (Text -> f Text) -> FeaturizationConfig -> f FeaturizationConfig
featurizationConfig_forecastFrequency = (FeaturizationConfig -> Text)
-> (FeaturizationConfig -> Text -> FeaturizationConfig)
-> Lens FeaturizationConfig FeaturizationConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeaturizationConfig' {Text
forecastFrequency :: Text
$sel:forecastFrequency:FeaturizationConfig' :: FeaturizationConfig -> Text
forecastFrequency} -> Text
forecastFrequency) (\s :: FeaturizationConfig
s@FeaturizationConfig' {} Text
a -> FeaturizationConfig
s {$sel:forecastFrequency:FeaturizationConfig' :: Text
forecastFrequency = Text
a} :: FeaturizationConfig)
instance Core.FromJSON FeaturizationConfig where
parseJSON :: Value -> Parser FeaturizationConfig
parseJSON =
String
-> (Object -> Parser FeaturizationConfig)
-> Value
-> Parser FeaturizationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FeaturizationConfig"
( \Object
x ->
Maybe (NonEmpty Featurization)
-> Maybe (NonEmpty Text) -> Text -> FeaturizationConfig
FeaturizationConfig'
(Maybe (NonEmpty Featurization)
-> Maybe (NonEmpty Text) -> Text -> FeaturizationConfig)
-> Parser (Maybe (NonEmpty Featurization))
-> Parser (Maybe (NonEmpty Text) -> Text -> FeaturizationConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Featurization))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Featurizations")
Parser (Maybe (NonEmpty Text) -> Text -> FeaturizationConfig)
-> Parser (Maybe (NonEmpty Text))
-> Parser (Text -> FeaturizationConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ForecastDimensions")
Parser (Text -> FeaturizationConfig)
-> Parser Text -> Parser FeaturizationConfig
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
"ForecastFrequency")
)
instance Prelude.Hashable FeaturizationConfig
instance Prelude.NFData FeaturizationConfig
instance Core.ToJSON FeaturizationConfig where
toJSON :: FeaturizationConfig -> Value
toJSON FeaturizationConfig' {Maybe (NonEmpty Text)
Maybe (NonEmpty Featurization)
Text
forecastFrequency :: Text
forecastDimensions :: Maybe (NonEmpty Text)
featurizations :: Maybe (NonEmpty Featurization)
$sel:forecastFrequency:FeaturizationConfig' :: FeaturizationConfig -> Text
$sel:forecastDimensions:FeaturizationConfig' :: FeaturizationConfig -> Maybe (NonEmpty Text)
$sel:featurizations:FeaturizationConfig' :: FeaturizationConfig -> Maybe (NonEmpty Featurization)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Featurizations" Text -> NonEmpty Featurization -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty Featurization -> Pair)
-> Maybe (NonEmpty Featurization) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Featurization)
featurizations,
(Text
"ForecastDimensions" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
forecastDimensions,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ForecastFrequency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
forecastFrequency)
]
)