{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LookoutEquipment.Types.DataPreProcessingConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DataPreProcessingConfiguration
 -> DataPreProcessingConfiguration -> Bool)
-> (DataPreProcessingConfiguration
    -> DataPreProcessingConfiguration -> Bool)
-> Eq DataPreProcessingConfiguration
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]
(Int -> ReadS DataPreProcessingConfiguration)
-> ReadS [DataPreProcessingConfiguration]
-> ReadPrec DataPreProcessingConfiguration
-> ReadPrec [DataPreProcessingConfiguration]
-> Read 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
(Int -> DataPreProcessingConfiguration -> ShowS)
-> (DataPreProcessingConfiguration -> String)
-> ([DataPreProcessingConfiguration] -> ShowS)
-> Show DataPreProcessingConfiguration
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.
 DataPreProcessingConfiguration
 -> Rep DataPreProcessingConfiguration x)
-> (forall x.
    Rep DataPreProcessingConfiguration x
    -> DataPreProcessingConfiguration)
-> Generic DataPreProcessingConfiguration
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' :: Maybe TargetSamplingRate -> DataPreProcessingConfiguration
DataPreProcessingConfiguration'
    { $sel:targetSamplingRate:DataPreProcessingConfiguration' :: Maybe TargetSamplingRate
targetSamplingRate =
        Maybe 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 :: (Maybe TargetSamplingRate -> f (Maybe TargetSamplingRate))
-> DataPreProcessingConfiguration
-> f DataPreProcessingConfiguration
dataPreProcessingConfiguration_targetSamplingRate = (DataPreProcessingConfiguration -> Maybe TargetSamplingRate)
-> (DataPreProcessingConfiguration
    -> Maybe TargetSamplingRate -> DataPreProcessingConfiguration)
-> Lens
     DataPreProcessingConfiguration
     DataPreProcessingConfiguration
     (Maybe TargetSamplingRate)
     (Maybe 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 Core.FromJSON DataPreProcessingConfiguration where
  parseJSON :: Value -> Parser DataPreProcessingConfiguration
parseJSON =
    String
-> (Object -> Parser DataPreProcessingConfiguration)
-> Value
-> Parser DataPreProcessingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataPreProcessingConfiguration"
      ( \Object
x ->
          Maybe TargetSamplingRate -> DataPreProcessingConfiguration
DataPreProcessingConfiguration'
            (Maybe TargetSamplingRate -> DataPreProcessingConfiguration)
-> Parser (Maybe TargetSamplingRate)
-> Parser DataPreProcessingConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TargetSamplingRate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetSamplingRate")
      )

instance
  Prelude.Hashable
    DataPreProcessingConfiguration

instance
  Prelude.NFData
    DataPreProcessingConfiguration

instance Core.ToJSON DataPreProcessingConfiguration where
  toJSON :: DataPreProcessingConfiguration -> Value
toJSON DataPreProcessingConfiguration' {Maybe TargetSamplingRate
targetSamplingRate :: Maybe TargetSamplingRate
$sel:targetSamplingRate:DataPreProcessingConfiguration' :: DataPreProcessingConfiguration -> Maybe TargetSamplingRate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TargetSamplingRate" Text -> TargetSamplingRate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TargetSamplingRate -> Pair)
-> Maybe TargetSamplingRate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TargetSamplingRate
targetSamplingRate
          ]
      )