{-# 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.DataExchange.Types.EventActionEntry
-- 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.DataExchange.Types.EventActionEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataExchange.Types.Action
import Amazonka.DataExchange.Types.Event
import qualified Amazonka.Prelude as Prelude

-- | An event action is an object that defines the relationship between a
-- specific event and an automated action that will be taken on behalf of
-- the customer.
--
-- /See:/ 'newEventActionEntry' smart constructor.
data EventActionEntry = EventActionEntry'
  { -- | What occurs after a certain event.
    EventActionEntry -> Action
action :: Action,
    -- | The Amazon Resource Name (ARN) for the event action.
    EventActionEntry -> Text
arn :: Prelude.Text,
    -- | The date and time that the event action was created, in ISO 8601 format.
    EventActionEntry -> ISO8601
createdAt :: Data.ISO8601,
    -- | What occurs to start an action.
    EventActionEntry -> Event
event :: Event,
    -- | The unique identifier for the event action.
    EventActionEntry -> Text
id :: Prelude.Text,
    -- | The date and time that the event action was last updated, in ISO 8601
    -- format.
    EventActionEntry -> ISO8601
updatedAt :: Data.ISO8601
  }
  deriving (EventActionEntry -> EventActionEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventActionEntry -> EventActionEntry -> Bool
$c/= :: EventActionEntry -> EventActionEntry -> Bool
== :: EventActionEntry -> EventActionEntry -> Bool
$c== :: EventActionEntry -> EventActionEntry -> Bool
Prelude.Eq, ReadPrec [EventActionEntry]
ReadPrec EventActionEntry
Int -> ReadS EventActionEntry
ReadS [EventActionEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventActionEntry]
$creadListPrec :: ReadPrec [EventActionEntry]
readPrec :: ReadPrec EventActionEntry
$creadPrec :: ReadPrec EventActionEntry
readList :: ReadS [EventActionEntry]
$creadList :: ReadS [EventActionEntry]
readsPrec :: Int -> ReadS EventActionEntry
$creadsPrec :: Int -> ReadS EventActionEntry
Prelude.Read, Int -> EventActionEntry -> ShowS
[EventActionEntry] -> ShowS
EventActionEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventActionEntry] -> ShowS
$cshowList :: [EventActionEntry] -> ShowS
show :: EventActionEntry -> String
$cshow :: EventActionEntry -> String
showsPrec :: Int -> EventActionEntry -> ShowS
$cshowsPrec :: Int -> EventActionEntry -> ShowS
Prelude.Show, forall x. Rep EventActionEntry x -> EventActionEntry
forall x. EventActionEntry -> Rep EventActionEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventActionEntry x -> EventActionEntry
$cfrom :: forall x. EventActionEntry -> Rep EventActionEntry x
Prelude.Generic)

-- |
-- Create a value of 'EventActionEntry' 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:
--
-- 'action', 'eventActionEntry_action' - What occurs after a certain event.
--
-- 'arn', 'eventActionEntry_arn' - The Amazon Resource Name (ARN) for the event action.
--
-- 'createdAt', 'eventActionEntry_createdAt' - The date and time that the event action was created, in ISO 8601 format.
--
-- 'event', 'eventActionEntry_event' - What occurs to start an action.
--
-- 'id', 'eventActionEntry_id' - The unique identifier for the event action.
--
-- 'updatedAt', 'eventActionEntry_updatedAt' - The date and time that the event action was last updated, in ISO 8601
-- format.
newEventActionEntry ::
  -- | 'action'
  Action ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'event'
  Event ->
  -- | 'id'
  Prelude.Text ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  EventActionEntry
newEventActionEntry :: Action
-> Text -> UTCTime -> Event -> Text -> UTCTime -> EventActionEntry
newEventActionEntry
  Action
pAction_
  Text
pArn_
  UTCTime
pCreatedAt_
  Event
pEvent_
  Text
pId_
  UTCTime
pUpdatedAt_ =
    EventActionEntry'
      { $sel:action:EventActionEntry' :: Action
action = Action
pAction_,
        $sel:arn:EventActionEntry' :: Text
arn = Text
pArn_,
        $sel:createdAt:EventActionEntry' :: ISO8601
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:event:EventActionEntry' :: Event
event = Event
pEvent_,
        $sel:id:EventActionEntry' :: Text
id = Text
pId_,
        $sel:updatedAt:EventActionEntry' :: ISO8601
updatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedAt_
      }

-- | What occurs after a certain event.
eventActionEntry_action :: Lens.Lens' EventActionEntry Action
eventActionEntry_action :: Lens' EventActionEntry Action
eventActionEntry_action = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {Action
action :: Action
$sel:action:EventActionEntry' :: EventActionEntry -> Action
action} -> Action
action) (\s :: EventActionEntry
s@EventActionEntry' {} Action
a -> EventActionEntry
s {$sel:action:EventActionEntry' :: Action
action = Action
a} :: EventActionEntry)

-- | The Amazon Resource Name (ARN) for the event action.
eventActionEntry_arn :: Lens.Lens' EventActionEntry Prelude.Text
eventActionEntry_arn :: Lens' EventActionEntry Text
eventActionEntry_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {Text
arn :: Text
$sel:arn:EventActionEntry' :: EventActionEntry -> Text
arn} -> Text
arn) (\s :: EventActionEntry
s@EventActionEntry' {} Text
a -> EventActionEntry
s {$sel:arn:EventActionEntry' :: Text
arn = Text
a} :: EventActionEntry)

-- | The date and time that the event action was created, in ISO 8601 format.
eventActionEntry_createdAt :: Lens.Lens' EventActionEntry Prelude.UTCTime
eventActionEntry_createdAt :: Lens' EventActionEntry UTCTime
eventActionEntry_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {ISO8601
createdAt :: ISO8601
$sel:createdAt:EventActionEntry' :: EventActionEntry -> ISO8601
createdAt} -> ISO8601
createdAt) (\s :: EventActionEntry
s@EventActionEntry' {} ISO8601
a -> EventActionEntry
s {$sel:createdAt:EventActionEntry' :: ISO8601
createdAt = ISO8601
a} :: EventActionEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | What occurs to start an action.
eventActionEntry_event :: Lens.Lens' EventActionEntry Event
eventActionEntry_event :: Lens' EventActionEntry Event
eventActionEntry_event = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {Event
event :: Event
$sel:event:EventActionEntry' :: EventActionEntry -> Event
event} -> Event
event) (\s :: EventActionEntry
s@EventActionEntry' {} Event
a -> EventActionEntry
s {$sel:event:EventActionEntry' :: Event
event = Event
a} :: EventActionEntry)

-- | The unique identifier for the event action.
eventActionEntry_id :: Lens.Lens' EventActionEntry Prelude.Text
eventActionEntry_id :: Lens' EventActionEntry Text
eventActionEntry_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {Text
id :: Text
$sel:id:EventActionEntry' :: EventActionEntry -> Text
id} -> Text
id) (\s :: EventActionEntry
s@EventActionEntry' {} Text
a -> EventActionEntry
s {$sel:id:EventActionEntry' :: Text
id = Text
a} :: EventActionEntry)

-- | The date and time that the event action was last updated, in ISO 8601
-- format.
eventActionEntry_updatedAt :: Lens.Lens' EventActionEntry Prelude.UTCTime
eventActionEntry_updatedAt :: Lens' EventActionEntry UTCTime
eventActionEntry_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventActionEntry' {ISO8601
updatedAt :: ISO8601
$sel:updatedAt:EventActionEntry' :: EventActionEntry -> ISO8601
updatedAt} -> ISO8601
updatedAt) (\s :: EventActionEntry
s@EventActionEntry' {} ISO8601
a -> EventActionEntry
s {$sel:updatedAt:EventActionEntry' :: ISO8601
updatedAt = ISO8601
a} :: EventActionEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON EventActionEntry where
  parseJSON :: Value -> Parser EventActionEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventActionEntry"
      ( \Object
x ->
          Action
-> Text -> ISO8601 -> Event -> Text -> ISO8601 -> EventActionEntry
EventActionEntry'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Action")
            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
"Arn")
            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
"CreatedAt")
            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
"Event")
            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
"Id")
            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
"UpdatedAt")
      )

instance Prelude.Hashable EventActionEntry where
  hashWithSalt :: Int -> EventActionEntry -> Int
hashWithSalt Int
_salt EventActionEntry' {Text
ISO8601
Event
Action
updatedAt :: ISO8601
id :: Text
event :: Event
createdAt :: ISO8601
arn :: Text
action :: Action
$sel:updatedAt:EventActionEntry' :: EventActionEntry -> ISO8601
$sel:id:EventActionEntry' :: EventActionEntry -> Text
$sel:event:EventActionEntry' :: EventActionEntry -> Event
$sel:createdAt:EventActionEntry' :: EventActionEntry -> ISO8601
$sel:arn:EventActionEntry' :: EventActionEntry -> Text
$sel:action:EventActionEntry' :: EventActionEntry -> Action
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Action
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Event
event
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
updatedAt

instance Prelude.NFData EventActionEntry where
  rnf :: EventActionEntry -> ()
rnf EventActionEntry' {Text
ISO8601
Event
Action
updatedAt :: ISO8601
id :: Text
event :: Event
createdAt :: ISO8601
arn :: Text
action :: Action
$sel:updatedAt:EventActionEntry' :: EventActionEntry -> ISO8601
$sel:id:EventActionEntry' :: EventActionEntry -> Text
$sel:event:EventActionEntry' :: EventActionEntry -> Event
$sel:createdAt:EventActionEntry' :: EventActionEntry -> ISO8601
$sel:arn:EventActionEntry' :: EventActionEntry -> Text
$sel:action:EventActionEntry' :: EventActionEntry -> Action
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Action
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Event
event
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
updatedAt