{-# 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.IoTAnalytics.Types.LateDataRuleConfiguration
-- 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.IoTAnalytics.Types.LateDataRuleConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.DeltaTimeSessionWindowConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The information needed to configure a delta time session window.
--
-- /See:/ 'newLateDataRuleConfiguration' smart constructor.
data LateDataRuleConfiguration = LateDataRuleConfiguration'
  { -- | The information needed to configure a delta time session window.
    LateDataRuleConfiguration
-> Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration :: Prelude.Maybe DeltaTimeSessionWindowConfiguration
  }
  deriving (LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool
(LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool)
-> (LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool)
-> Eq LateDataRuleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool
$c/= :: LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool
== :: LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool
$c== :: LateDataRuleConfiguration -> LateDataRuleConfiguration -> Bool
Prelude.Eq, ReadPrec [LateDataRuleConfiguration]
ReadPrec LateDataRuleConfiguration
Int -> ReadS LateDataRuleConfiguration
ReadS [LateDataRuleConfiguration]
(Int -> ReadS LateDataRuleConfiguration)
-> ReadS [LateDataRuleConfiguration]
-> ReadPrec LateDataRuleConfiguration
-> ReadPrec [LateDataRuleConfiguration]
-> Read LateDataRuleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LateDataRuleConfiguration]
$creadListPrec :: ReadPrec [LateDataRuleConfiguration]
readPrec :: ReadPrec LateDataRuleConfiguration
$creadPrec :: ReadPrec LateDataRuleConfiguration
readList :: ReadS [LateDataRuleConfiguration]
$creadList :: ReadS [LateDataRuleConfiguration]
readsPrec :: Int -> ReadS LateDataRuleConfiguration
$creadsPrec :: Int -> ReadS LateDataRuleConfiguration
Prelude.Read, Int -> LateDataRuleConfiguration -> ShowS
[LateDataRuleConfiguration] -> ShowS
LateDataRuleConfiguration -> String
(Int -> LateDataRuleConfiguration -> ShowS)
-> (LateDataRuleConfiguration -> String)
-> ([LateDataRuleConfiguration] -> ShowS)
-> Show LateDataRuleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LateDataRuleConfiguration] -> ShowS
$cshowList :: [LateDataRuleConfiguration] -> ShowS
show :: LateDataRuleConfiguration -> String
$cshow :: LateDataRuleConfiguration -> String
showsPrec :: Int -> LateDataRuleConfiguration -> ShowS
$cshowsPrec :: Int -> LateDataRuleConfiguration -> ShowS
Prelude.Show, (forall x.
 LateDataRuleConfiguration -> Rep LateDataRuleConfiguration x)
-> (forall x.
    Rep LateDataRuleConfiguration x -> LateDataRuleConfiguration)
-> Generic LateDataRuleConfiguration
forall x.
Rep LateDataRuleConfiguration x -> LateDataRuleConfiguration
forall x.
LateDataRuleConfiguration -> Rep LateDataRuleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LateDataRuleConfiguration x -> LateDataRuleConfiguration
$cfrom :: forall x.
LateDataRuleConfiguration -> Rep LateDataRuleConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LateDataRuleConfiguration' 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:
--
-- 'deltaTimeSessionWindowConfiguration', 'lateDataRuleConfiguration_deltaTimeSessionWindowConfiguration' - The information needed to configure a delta time session window.
newLateDataRuleConfiguration ::
  LateDataRuleConfiguration
newLateDataRuleConfiguration :: LateDataRuleConfiguration
newLateDataRuleConfiguration =
  LateDataRuleConfiguration' :: Maybe DeltaTimeSessionWindowConfiguration
-> LateDataRuleConfiguration
LateDataRuleConfiguration'
    { $sel:deltaTimeSessionWindowConfiguration:LateDataRuleConfiguration' :: Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration =
        Maybe DeltaTimeSessionWindowConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | The information needed to configure a delta time session window.
lateDataRuleConfiguration_deltaTimeSessionWindowConfiguration :: Lens.Lens' LateDataRuleConfiguration (Prelude.Maybe DeltaTimeSessionWindowConfiguration)
lateDataRuleConfiguration_deltaTimeSessionWindowConfiguration :: (Maybe DeltaTimeSessionWindowConfiguration
 -> f (Maybe DeltaTimeSessionWindowConfiguration))
-> LateDataRuleConfiguration -> f LateDataRuleConfiguration
lateDataRuleConfiguration_deltaTimeSessionWindowConfiguration = (LateDataRuleConfiguration
 -> Maybe DeltaTimeSessionWindowConfiguration)
-> (LateDataRuleConfiguration
    -> Maybe DeltaTimeSessionWindowConfiguration
    -> LateDataRuleConfiguration)
-> Lens
     LateDataRuleConfiguration
     LateDataRuleConfiguration
     (Maybe DeltaTimeSessionWindowConfiguration)
     (Maybe DeltaTimeSessionWindowConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LateDataRuleConfiguration' {Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration :: Maybe DeltaTimeSessionWindowConfiguration
$sel:deltaTimeSessionWindowConfiguration:LateDataRuleConfiguration' :: LateDataRuleConfiguration
-> Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration} -> Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration) (\s :: LateDataRuleConfiguration
s@LateDataRuleConfiguration' {} Maybe DeltaTimeSessionWindowConfiguration
a -> LateDataRuleConfiguration
s {$sel:deltaTimeSessionWindowConfiguration:LateDataRuleConfiguration' :: Maybe DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration = Maybe DeltaTimeSessionWindowConfiguration
a} :: LateDataRuleConfiguration)

instance Core.FromJSON LateDataRuleConfiguration where
  parseJSON :: Value -> Parser LateDataRuleConfiguration
parseJSON =
    String
-> (Object -> Parser LateDataRuleConfiguration)
-> Value
-> Parser LateDataRuleConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LateDataRuleConfiguration"
      ( \Object
x ->
          Maybe DeltaTimeSessionWindowConfiguration
-> LateDataRuleConfiguration
LateDataRuleConfiguration'
            (Maybe DeltaTimeSessionWindowConfiguration
 -> LateDataRuleConfiguration)
-> Parser (Maybe DeltaTimeSessionWindowConfiguration)
-> Parser LateDataRuleConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe DeltaTimeSessionWindowConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deltaTimeSessionWindowConfiguration")
      )

instance Prelude.Hashable LateDataRuleConfiguration

instance Prelude.NFData LateDataRuleConfiguration

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