{-# 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.FraudDetector.Types.IngestedEventsDetail
-- 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.FraudDetector.Types.IngestedEventsDetail where

import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.IngestedEventsTimeWindow
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of the ingested event.
--
-- /See:/ 'newIngestedEventsDetail' smart constructor.
data IngestedEventsDetail = IngestedEventsDetail'
  { -- | The start and stop time of the ingested events.
    IngestedEventsDetail -> IngestedEventsTimeWindow
ingestedEventsTimeWindow :: IngestedEventsTimeWindow
  }
  deriving (IngestedEventsDetail -> IngestedEventsDetail -> Bool
(IngestedEventsDetail -> IngestedEventsDetail -> Bool)
-> (IngestedEventsDetail -> IngestedEventsDetail -> Bool)
-> Eq IngestedEventsDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IngestedEventsDetail -> IngestedEventsDetail -> Bool
$c/= :: IngestedEventsDetail -> IngestedEventsDetail -> Bool
== :: IngestedEventsDetail -> IngestedEventsDetail -> Bool
$c== :: IngestedEventsDetail -> IngestedEventsDetail -> Bool
Prelude.Eq, ReadPrec [IngestedEventsDetail]
ReadPrec IngestedEventsDetail
Int -> ReadS IngestedEventsDetail
ReadS [IngestedEventsDetail]
(Int -> ReadS IngestedEventsDetail)
-> ReadS [IngestedEventsDetail]
-> ReadPrec IngestedEventsDetail
-> ReadPrec [IngestedEventsDetail]
-> Read IngestedEventsDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IngestedEventsDetail]
$creadListPrec :: ReadPrec [IngestedEventsDetail]
readPrec :: ReadPrec IngestedEventsDetail
$creadPrec :: ReadPrec IngestedEventsDetail
readList :: ReadS [IngestedEventsDetail]
$creadList :: ReadS [IngestedEventsDetail]
readsPrec :: Int -> ReadS IngestedEventsDetail
$creadsPrec :: Int -> ReadS IngestedEventsDetail
Prelude.Read, Int -> IngestedEventsDetail -> ShowS
[IngestedEventsDetail] -> ShowS
IngestedEventsDetail -> String
(Int -> IngestedEventsDetail -> ShowS)
-> (IngestedEventsDetail -> String)
-> ([IngestedEventsDetail] -> ShowS)
-> Show IngestedEventsDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IngestedEventsDetail] -> ShowS
$cshowList :: [IngestedEventsDetail] -> ShowS
show :: IngestedEventsDetail -> String
$cshow :: IngestedEventsDetail -> String
showsPrec :: Int -> IngestedEventsDetail -> ShowS
$cshowsPrec :: Int -> IngestedEventsDetail -> ShowS
Prelude.Show, (forall x. IngestedEventsDetail -> Rep IngestedEventsDetail x)
-> (forall x. Rep IngestedEventsDetail x -> IngestedEventsDetail)
-> Generic IngestedEventsDetail
forall x. Rep IngestedEventsDetail x -> IngestedEventsDetail
forall x. IngestedEventsDetail -> Rep IngestedEventsDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IngestedEventsDetail x -> IngestedEventsDetail
$cfrom :: forall x. IngestedEventsDetail -> Rep IngestedEventsDetail x
Prelude.Generic)

-- |
-- Create a value of 'IngestedEventsDetail' 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:
--
-- 'ingestedEventsTimeWindow', 'ingestedEventsDetail_ingestedEventsTimeWindow' - The start and stop time of the ingested events.
newIngestedEventsDetail ::
  -- | 'ingestedEventsTimeWindow'
  IngestedEventsTimeWindow ->
  IngestedEventsDetail
newIngestedEventsDetail :: IngestedEventsTimeWindow -> IngestedEventsDetail
newIngestedEventsDetail IngestedEventsTimeWindow
pIngestedEventsTimeWindow_ =
  IngestedEventsDetail' :: IngestedEventsTimeWindow -> IngestedEventsDetail
IngestedEventsDetail'
    { $sel:ingestedEventsTimeWindow:IngestedEventsDetail' :: IngestedEventsTimeWindow
ingestedEventsTimeWindow =
        IngestedEventsTimeWindow
pIngestedEventsTimeWindow_
    }

-- | The start and stop time of the ingested events.
ingestedEventsDetail_ingestedEventsTimeWindow :: Lens.Lens' IngestedEventsDetail IngestedEventsTimeWindow
ingestedEventsDetail_ingestedEventsTimeWindow :: (IngestedEventsTimeWindow -> f IngestedEventsTimeWindow)
-> IngestedEventsDetail -> f IngestedEventsDetail
ingestedEventsDetail_ingestedEventsTimeWindow = (IngestedEventsDetail -> IngestedEventsTimeWindow)
-> (IngestedEventsDetail
    -> IngestedEventsTimeWindow -> IngestedEventsDetail)
-> Lens
     IngestedEventsDetail
     IngestedEventsDetail
     IngestedEventsTimeWindow
     IngestedEventsTimeWindow
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngestedEventsDetail' {IngestedEventsTimeWindow
ingestedEventsTimeWindow :: IngestedEventsTimeWindow
$sel:ingestedEventsTimeWindow:IngestedEventsDetail' :: IngestedEventsDetail -> IngestedEventsTimeWindow
ingestedEventsTimeWindow} -> IngestedEventsTimeWindow
ingestedEventsTimeWindow) (\s :: IngestedEventsDetail
s@IngestedEventsDetail' {} IngestedEventsTimeWindow
a -> IngestedEventsDetail
s {$sel:ingestedEventsTimeWindow:IngestedEventsDetail' :: IngestedEventsTimeWindow
ingestedEventsTimeWindow = IngestedEventsTimeWindow
a} :: IngestedEventsDetail)

instance Core.FromJSON IngestedEventsDetail where
  parseJSON :: Value -> Parser IngestedEventsDetail
parseJSON =
    String
-> (Object -> Parser IngestedEventsDetail)
-> Value
-> Parser IngestedEventsDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IngestedEventsDetail"
      ( \Object
x ->
          IngestedEventsTimeWindow -> IngestedEventsDetail
IngestedEventsDetail'
            (IngestedEventsTimeWindow -> IngestedEventsDetail)
-> Parser IngestedEventsTimeWindow -> Parser IngestedEventsDetail
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser IngestedEventsTimeWindow
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ingestedEventsTimeWindow")
      )

instance Prelude.Hashable IngestedEventsDetail

instance Prelude.NFData IngestedEventsDetail

instance Core.ToJSON IngestedEventsDetail where
  toJSON :: IngestedEventsDetail -> Value
toJSON IngestedEventsDetail' {IngestedEventsTimeWindow
ingestedEventsTimeWindow :: IngestedEventsTimeWindow
$sel:ingestedEventsTimeWindow:IngestedEventsDetail' :: IngestedEventsDetail -> IngestedEventsTimeWindow
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ingestedEventsTimeWindow"
                  Text -> IngestedEventsTimeWindow -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IngestedEventsTimeWindow
ingestedEventsTimeWindow
              )
          ]
      )