{-# 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.LookoutEquipment.Types.DataPreProcessingConfiguration
-- 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.LookoutEquipment.Types.DataPreProcessingConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutEquipment.Types.TargetSamplingRate
import qualified Amazonka.Prelude as Prelude

-- | The configuration is the @TargetSamplingRate@, which is the sampling
-- rate of the data after post processing by Amazon Lookout for Equipment.
-- For example, if you provide data that has been collected at a 1 second
-- level and you want the system to resample the data at a 1 minute rate
-- before training, the @TargetSamplingRate@ is 1 minute.
--
-- When providing a value for the @TargetSamplingRate@, you must attach the
-- prefix \"PT\" to the rate you want. The value for a 1 second rate is
-- therefore /PT1S/, the value for a 15 minute rate is /PT15M/, and the
-- value for a 1 hour rate is /PT1H/
--
-- /See:/ 'newDataPreProcessingConfiguration' smart constructor.
data DataPreProcessingConfiguration = DataPreProcessingConfiguration'
  { -- | The sampling rate of the data after post processing by Amazon Lookout
    -- for Equipment. For example, if you provide data that has been collected
    -- at a 1 second level and you want the system to resample the data at a 1
    -- minute rate before training, the @TargetSamplingRate@ is 1 minute.
    --
    -- When providing a value for the @TargetSamplingRate@, you must attach the
    -- prefix \"PT\" to the rate you want. The value for a 1 second rate is
    -- therefore /PT1S/, the value for a 15 minute rate is /PT15M/, and the
    -- value for a 1 hour rate is /PT1H/
    DataPreProcessingConfiguration -> Maybe TargetSamplingRate
targetSamplingRate :: Prelude.Maybe TargetSamplingRate
  }
  deriving (DataPreProcessingConfiguration
-> DataPreProcessingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataPreProcessingConfiguration
-> DataPreProcessingConfiguration -> Bool
$c/= :: DataPreProcessingConfiguration
-> DataPreProcessingConfiguration -> Bool
== :: DataPreProcessingConfiguration
-> DataPreProcessingConfiguration -> Bool
$c== :: DataPreProcessingConfiguration
-> DataPreProcessingConfiguration -> Bool
Prelude.Eq, ReadPrec [DataPreProcessingConfiguration]
ReadPrec DataPreProcessingConfiguration
Int -> ReadS DataPreProcessingConfiguration
ReadS [DataPreProcessingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataPreProcessingConfiguration]
$creadListPrec :: ReadPrec [DataPreProcessingConfiguration]
readPrec :: ReadPrec DataPreProcessingConfiguration
$creadPrec :: ReadPrec DataPreProcessingConfiguration
readList :: ReadS [DataPreProcessingConfiguration]
$creadList :: ReadS [DataPreProcessingConfiguration]
readsPrec :: Int -> ReadS DataPreProcessingConfiguration
$creadsPrec :: Int -> ReadS DataPreProcessingConfiguration
Prelude.Read, Int -> DataPreProcessingConfiguration -> ShowS
[DataPreProcessingConfiguration] -> ShowS
DataPreProcessingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataPreProcessingConfiguration] -> ShowS
$cshowList :: [DataPreProcessingConfiguration] -> ShowS
show :: DataPreProcessingConfiguration -> String
$cshow :: DataPreProcessingConfiguration -> String
showsPrec :: Int -> DataPreProcessingConfiguration -> ShowS
$cshowsPrec :: Int -> DataPreProcessingConfiguration -> ShowS
Prelude.Show, forall x.
Rep DataPreProcessingConfiguration x
-> DataPreProcessingConfiguration
forall x.
DataPreProcessingConfiguration
-> Rep DataPreProcessingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataPreProcessingConfiguration x
-> DataPreProcessingConfiguration
$cfrom :: forall x.
DataPreProcessingConfiguration
-> Rep DataPreProcessingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DataPreProcessingConfiguration' 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:
--
-- 'targetSamplingRate', 'dataPreProcessingConfiguration_targetSamplingRate' - The sampling rate of the data after post processing by Amazon Lookout
-- for Equipment. For example, if you provide data that has been collected
-- at a 1 second level and you want the system to resample the data at a 1
-- minute rate before training, the @TargetSamplingRate@ is 1 minute.
--
-- When providing a value for the @TargetSamplingRate@, you must attach the
-- prefix \"PT\" to the rate you want. The value for a 1 second rate is
-- therefore /PT1S/, the value for a 15 minute rate is /PT15M/, and the
-- value for a 1 hour rate is /PT1H/
newDataPreProcessingConfiguration ::
  DataPreProcessingConfiguration
newDataPreProcessingConfiguration :: DataPreProcessingConfiguration
newDataPreProcessingConfiguration =
  DataPreProcessingConfiguration'
    { $sel:targetSamplingRate:DataPreProcessingConfiguration' :: Maybe TargetSamplingRate
targetSamplingRate =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The sampling rate of the data after post processing by Amazon Lookout
-- for Equipment. For example, if you provide data that has been collected
-- at a 1 second level and you want the system to resample the data at a 1
-- minute rate before training, the @TargetSamplingRate@ is 1 minute.
--
-- When providing a value for the @TargetSamplingRate@, you must attach the
-- prefix \"PT\" to the rate you want. The value for a 1 second rate is
-- therefore /PT1S/, the value for a 15 minute rate is /PT15M/, and the
-- value for a 1 hour rate is /PT1H/
dataPreProcessingConfiguration_targetSamplingRate :: Lens.Lens' DataPreProcessingConfiguration (Prelude.Maybe TargetSamplingRate)
dataPreProcessingConfiguration_targetSamplingRate :: Lens' DataPreProcessingConfiguration (Maybe TargetSamplingRate)
dataPreProcessingConfiguration_targetSamplingRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataPreProcessingConfiguration' {Maybe TargetSamplingRate
targetSamplingRate :: Maybe TargetSamplingRate
$sel:targetSamplingRate:DataPreProcessingConfiguration' :: DataPreProcessingConfiguration -> Maybe TargetSamplingRate
targetSamplingRate} -> Maybe TargetSamplingRate
targetSamplingRate) (\s :: DataPreProcessingConfiguration
s@DataPreProcessingConfiguration' {} Maybe TargetSamplingRate
a -> DataPreProcessingConfiguration
s {$sel:targetSamplingRate:DataPreProcessingConfiguration' :: Maybe TargetSamplingRate
targetSamplingRate = Maybe TargetSamplingRate
a} :: DataPreProcessingConfiguration)

instance Data.FromJSON DataPreProcessingConfiguration where
  parseJSON :: Value -> Parser DataPreProcessingConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataPreProcessingConfiguration"
      ( \Object
x ->
          Maybe TargetSamplingRate -> DataPreProcessingConfiguration
DataPreProcessingConfiguration'
            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
"TargetSamplingRate")
      )

instance
  Prelude.Hashable
    DataPreProcessingConfiguration
  where
  hashWithSalt :: Int -> DataPreProcessingConfiguration -> Int
hashWithSalt
    Int
_salt
    DataPreProcessingConfiguration' {Maybe TargetSamplingRate
targetSamplingRate :: Maybe TargetSamplingRate
$sel:targetSamplingRate:DataPreProcessingConfiguration' :: DataPreProcessingConfiguration -> Maybe TargetSamplingRate
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetSamplingRate
targetSamplingRate

instance
  Prelude.NFData
    DataPreProcessingConfiguration
  where
  rnf :: DataPreProcessingConfiguration -> ()
rnf DataPreProcessingConfiguration' {Maybe TargetSamplingRate
targetSamplingRate :: Maybe TargetSamplingRate
$sel:targetSamplingRate:DataPreProcessingConfiguration' :: DataPreProcessingConfiguration -> Maybe TargetSamplingRate
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetSamplingRate
targetSamplingRate

instance Data.ToJSON DataPreProcessingConfiguration where
  toJSON :: DataPreProcessingConfiguration -> Value
toJSON DataPreProcessingConfiguration' {Maybe TargetSamplingRate
targetSamplingRate :: Maybe TargetSamplingRate
$sel:targetSamplingRate:DataPreProcessingConfiguration' :: DataPreProcessingConfiguration -> Maybe TargetSamplingRate
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"TargetSamplingRate" 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 TargetSamplingRate
targetSamplingRate
          ]
      )