{-# 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.CategoricalParameterRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CategoricalParameterRange = CategoricalParameterRange'
{
CategoricalParameterRange -> Text
name :: Prelude.Text,
CategoricalParameterRange -> NonEmpty Text
values :: Prelude.NonEmpty Prelude.Text
}
deriving (CategoricalParameterRange -> CategoricalParameterRange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CategoricalParameterRange -> CategoricalParameterRange -> Bool
$c/= :: CategoricalParameterRange -> CategoricalParameterRange -> Bool
== :: CategoricalParameterRange -> CategoricalParameterRange -> Bool
$c== :: CategoricalParameterRange -> CategoricalParameterRange -> Bool
Prelude.Eq, ReadPrec [CategoricalParameterRange]
ReadPrec CategoricalParameterRange
Int -> ReadS CategoricalParameterRange
ReadS [CategoricalParameterRange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CategoricalParameterRange]
$creadListPrec :: ReadPrec [CategoricalParameterRange]
readPrec :: ReadPrec CategoricalParameterRange
$creadPrec :: ReadPrec CategoricalParameterRange
readList :: ReadS [CategoricalParameterRange]
$creadList :: ReadS [CategoricalParameterRange]
readsPrec :: Int -> ReadS CategoricalParameterRange
$creadsPrec :: Int -> ReadS CategoricalParameterRange
Prelude.Read, Int -> CategoricalParameterRange -> ShowS
[CategoricalParameterRange] -> ShowS
CategoricalParameterRange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CategoricalParameterRange] -> ShowS
$cshowList :: [CategoricalParameterRange] -> ShowS
show :: CategoricalParameterRange -> String
$cshow :: CategoricalParameterRange -> String
showsPrec :: Int -> CategoricalParameterRange -> ShowS
$cshowsPrec :: Int -> CategoricalParameterRange -> ShowS
Prelude.Show, forall x.
Rep CategoricalParameterRange x -> CategoricalParameterRange
forall x.
CategoricalParameterRange -> Rep CategoricalParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CategoricalParameterRange x -> CategoricalParameterRange
$cfrom :: forall x.
CategoricalParameterRange -> Rep CategoricalParameterRange x
Prelude.Generic)
newCategoricalParameterRange ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
CategoricalParameterRange
newCategoricalParameterRange :: Text -> NonEmpty Text -> CategoricalParameterRange
newCategoricalParameterRange Text
pName_ NonEmpty Text
pValues_ =
CategoricalParameterRange'
{ $sel:name:CategoricalParameterRange' :: Text
name = Text
pName_,
$sel:values:CategoricalParameterRange' :: NonEmpty Text
values = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pValues_
}
categoricalParameterRange_name :: Lens.Lens' CategoricalParameterRange Prelude.Text
categoricalParameterRange_name :: Lens' CategoricalParameterRange Text
categoricalParameterRange_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalParameterRange' {Text
name :: Text
$sel:name:CategoricalParameterRange' :: CategoricalParameterRange -> Text
name} -> Text
name) (\s :: CategoricalParameterRange
s@CategoricalParameterRange' {} Text
a -> CategoricalParameterRange
s {$sel:name:CategoricalParameterRange' :: Text
name = Text
a} :: CategoricalParameterRange)
categoricalParameterRange_values :: Lens.Lens' CategoricalParameterRange (Prelude.NonEmpty Prelude.Text)
categoricalParameterRange_values :: Lens' CategoricalParameterRange (NonEmpty Text)
categoricalParameterRange_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoricalParameterRange' {NonEmpty Text
values :: NonEmpty Text
$sel:values:CategoricalParameterRange' :: CategoricalParameterRange -> NonEmpty Text
values} -> NonEmpty Text
values) (\s :: CategoricalParameterRange
s@CategoricalParameterRange' {} NonEmpty Text
a -> CategoricalParameterRange
s {$sel:values:CategoricalParameterRange' :: NonEmpty Text
values = NonEmpty Text
a} :: CategoricalParameterRange) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON CategoricalParameterRange where
parseJSON :: Value -> Parser CategoricalParameterRange
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CategoricalParameterRange"
( \Object
x ->
Text -> NonEmpty Text -> CategoricalParameterRange
CategoricalParameterRange'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Values")
)
instance Prelude.Hashable CategoricalParameterRange where
hashWithSalt :: Int -> CategoricalParameterRange -> Int
hashWithSalt Int
_salt CategoricalParameterRange' {NonEmpty Text
Text
values :: NonEmpty Text
name :: Text
$sel:values:CategoricalParameterRange' :: CategoricalParameterRange -> NonEmpty Text
$sel:name:CategoricalParameterRange' :: CategoricalParameterRange -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
values
instance Prelude.NFData CategoricalParameterRange where
rnf :: CategoricalParameterRange -> ()
rnf CategoricalParameterRange' {NonEmpty Text
Text
values :: NonEmpty Text
name :: Text
$sel:values:CategoricalParameterRange' :: CategoricalParameterRange -> NonEmpty Text
$sel:name:CategoricalParameterRange' :: CategoricalParameterRange -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
values
instance Data.ToJSON CategoricalParameterRange where
toJSON :: CategoricalParameterRange -> Value
toJSON CategoricalParameterRange' {NonEmpty Text
Text
values :: NonEmpty Text
name :: Text
$sel:values:CategoricalParameterRange' :: CategoricalParameterRange -> NonEmpty Text
$sel:name:CategoricalParameterRange' :: CategoricalParameterRange -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
values)
]
)