{-# 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.Forecast.Types.InputDataConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Forecast.Types.InputDataConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Forecast.Types.SupplementaryFeature
import qualified Amazonka.Prelude as Prelude

-- | This object belongs to the CreatePredictor operation. If you created
-- your predictor with CreateAutoPredictor, see DataConfig.
--
-- The data used to train a predictor. The data includes a dataset group
-- and any supplementary features. You specify this object in the
-- CreatePredictor request.
--
-- /See:/ 'newInputDataConfig' smart constructor.
data InputDataConfig = InputDataConfig'
  { -- | An array of supplementary features. The only supported feature is a
    -- holiday calendar.
    InputDataConfig -> Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures :: Prelude.Maybe (Prelude.NonEmpty SupplementaryFeature),
    -- | The Amazon Resource Name (ARN) of the dataset group.
    InputDataConfig -> Text
datasetGroupArn :: Prelude.Text
  }
  deriving (InputDataConfig -> InputDataConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDataConfig -> InputDataConfig -> Bool
$c/= :: InputDataConfig -> InputDataConfig -> Bool
== :: InputDataConfig -> InputDataConfig -> Bool
$c== :: InputDataConfig -> InputDataConfig -> Bool
Prelude.Eq, ReadPrec [InputDataConfig]
ReadPrec InputDataConfig
Int -> ReadS InputDataConfig
ReadS [InputDataConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDataConfig]
$creadListPrec :: ReadPrec [InputDataConfig]
readPrec :: ReadPrec InputDataConfig
$creadPrec :: ReadPrec InputDataConfig
readList :: ReadS [InputDataConfig]
$creadList :: ReadS [InputDataConfig]
readsPrec :: Int -> ReadS InputDataConfig
$creadsPrec :: Int -> ReadS InputDataConfig
Prelude.Read, Int -> InputDataConfig -> ShowS
[InputDataConfig] -> ShowS
InputDataConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDataConfig] -> ShowS
$cshowList :: [InputDataConfig] -> ShowS
show :: InputDataConfig -> String
$cshow :: InputDataConfig -> String
showsPrec :: Int -> InputDataConfig -> ShowS
$cshowsPrec :: Int -> InputDataConfig -> ShowS
Prelude.Show, forall x. Rep InputDataConfig x -> InputDataConfig
forall x. InputDataConfig -> Rep InputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputDataConfig x -> InputDataConfig
$cfrom :: forall x. InputDataConfig -> Rep InputDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'InputDataConfig' 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:
--
-- 'supplementaryFeatures', 'inputDataConfig_supplementaryFeatures' - An array of supplementary features. The only supported feature is a
-- holiday calendar.
--
-- 'datasetGroupArn', 'inputDataConfig_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group.
newInputDataConfig ::
  -- | 'datasetGroupArn'
  Prelude.Text ->
  InputDataConfig
newInputDataConfig :: Text -> InputDataConfig
newInputDataConfig Text
pDatasetGroupArn_ =
  InputDataConfig'
    { $sel:supplementaryFeatures:InputDataConfig' :: Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures =
        forall a. Maybe a
Prelude.Nothing,
      $sel:datasetGroupArn:InputDataConfig' :: Text
datasetGroupArn = Text
pDatasetGroupArn_
    }

-- | An array of supplementary features. The only supported feature is a
-- holiday calendar.
inputDataConfig_supplementaryFeatures :: Lens.Lens' InputDataConfig (Prelude.Maybe (Prelude.NonEmpty SupplementaryFeature))
inputDataConfig_supplementaryFeatures :: Lens' InputDataConfig (Maybe (NonEmpty SupplementaryFeature))
inputDataConfig_supplementaryFeatures = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures :: Maybe (NonEmpty SupplementaryFeature)
$sel:supplementaryFeatures:InputDataConfig' :: InputDataConfig -> Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures} -> Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures) (\s :: InputDataConfig
s@InputDataConfig' {} Maybe (NonEmpty SupplementaryFeature)
a -> InputDataConfig
s {$sel:supplementaryFeatures:InputDataConfig' :: Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures = Maybe (NonEmpty SupplementaryFeature)
a} :: InputDataConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the dataset group.
inputDataConfig_datasetGroupArn :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_datasetGroupArn :: Lens' InputDataConfig Text
inputDataConfig_datasetGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:InputDataConfig' :: InputDataConfig -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:datasetGroupArn:InputDataConfig' :: Text
datasetGroupArn = Text
a} :: InputDataConfig)

instance Data.FromJSON InputDataConfig where
  parseJSON :: Value -> Parser InputDataConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputDataConfig"
      ( \Object
x ->
          Maybe (NonEmpty SupplementaryFeature) -> Text -> InputDataConfig
InputDataConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SupplementaryFeatures")
            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
"DatasetGroupArn")
      )

instance Prelude.Hashable InputDataConfig where
  hashWithSalt :: Int -> InputDataConfig -> Int
hashWithSalt Int
_salt InputDataConfig' {Maybe (NonEmpty SupplementaryFeature)
Text
datasetGroupArn :: Text
supplementaryFeatures :: Maybe (NonEmpty SupplementaryFeature)
$sel:datasetGroupArn:InputDataConfig' :: InputDataConfig -> Text
$sel:supplementaryFeatures:InputDataConfig' :: InputDataConfig -> Maybe (NonEmpty SupplementaryFeature)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
datasetGroupArn

instance Prelude.NFData InputDataConfig where
  rnf :: InputDataConfig -> ()
rnf InputDataConfig' {Maybe (NonEmpty SupplementaryFeature)
Text
datasetGroupArn :: Text
supplementaryFeatures :: Maybe (NonEmpty SupplementaryFeature)
$sel:datasetGroupArn:InputDataConfig' :: InputDataConfig -> Text
$sel:supplementaryFeatures:InputDataConfig' :: InputDataConfig -> Maybe (NonEmpty SupplementaryFeature)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
datasetGroupArn

instance Data.ToJSON InputDataConfig where
  toJSON :: InputDataConfig -> Value
toJSON InputDataConfig' {Maybe (NonEmpty SupplementaryFeature)
Text
datasetGroupArn :: Text
supplementaryFeatures :: Maybe (NonEmpty SupplementaryFeature)
$sel:datasetGroupArn:InputDataConfig' :: InputDataConfig -> Text
$sel:supplementaryFeatures:InputDataConfig' :: InputDataConfig -> Maybe (NonEmpty SupplementaryFeature)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SupplementaryFeatures" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty SupplementaryFeature)
supplementaryFeatures,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DatasetGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
datasetGroupArn)
          ]
      )