{-# 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.IoTWireless.Types.EventConfigurationItem
-- 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.IoTWireless.Types.EventConfigurationItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types.EventNotificationItemConfigurations
import Amazonka.IoTWireless.Types.EventNotificationPartnerType
import Amazonka.IoTWireless.Types.IdentifierType
import qualified Amazonka.Prelude as Prelude

-- | Event configuration object for a single resource.
--
-- /See:/ 'newEventConfigurationItem' smart constructor.
data EventConfigurationItem = EventConfigurationItem'
  { EventConfigurationItem -> Maybe EventNotificationItemConfigurations
events :: Prelude.Maybe EventNotificationItemConfigurations,
    -- | Resource identifier opted in for event messaging.
    EventConfigurationItem -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | Identifier type of the particular resource identifier for event
    -- configuration.
    EventConfigurationItem -> Maybe IdentifierType
identifierType :: Prelude.Maybe IdentifierType,
    -- | Partner type of the resource if the identifier type is PartnerAccountId.
    EventConfigurationItem -> Maybe EventNotificationPartnerType
partnerType :: Prelude.Maybe EventNotificationPartnerType
  }
  deriving (EventConfigurationItem -> EventConfigurationItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventConfigurationItem -> EventConfigurationItem -> Bool
$c/= :: EventConfigurationItem -> EventConfigurationItem -> Bool
== :: EventConfigurationItem -> EventConfigurationItem -> Bool
$c== :: EventConfigurationItem -> EventConfigurationItem -> Bool
Prelude.Eq, ReadPrec [EventConfigurationItem]
ReadPrec EventConfigurationItem
Int -> ReadS EventConfigurationItem
ReadS [EventConfigurationItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventConfigurationItem]
$creadListPrec :: ReadPrec [EventConfigurationItem]
readPrec :: ReadPrec EventConfigurationItem
$creadPrec :: ReadPrec EventConfigurationItem
readList :: ReadS [EventConfigurationItem]
$creadList :: ReadS [EventConfigurationItem]
readsPrec :: Int -> ReadS EventConfigurationItem
$creadsPrec :: Int -> ReadS EventConfigurationItem
Prelude.Read, Int -> EventConfigurationItem -> ShowS
[EventConfigurationItem] -> ShowS
EventConfigurationItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventConfigurationItem] -> ShowS
$cshowList :: [EventConfigurationItem] -> ShowS
show :: EventConfigurationItem -> String
$cshow :: EventConfigurationItem -> String
showsPrec :: Int -> EventConfigurationItem -> ShowS
$cshowsPrec :: Int -> EventConfigurationItem -> ShowS
Prelude.Show, forall x. Rep EventConfigurationItem x -> EventConfigurationItem
forall x. EventConfigurationItem -> Rep EventConfigurationItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventConfigurationItem x -> EventConfigurationItem
$cfrom :: forall x. EventConfigurationItem -> Rep EventConfigurationItem x
Prelude.Generic)

-- |
-- Create a value of 'EventConfigurationItem' 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:
--
-- 'events', 'eventConfigurationItem_events' - Undocumented member.
--
-- 'identifier', 'eventConfigurationItem_identifier' - Resource identifier opted in for event messaging.
--
-- 'identifierType', 'eventConfigurationItem_identifierType' - Identifier type of the particular resource identifier for event
-- configuration.
--
-- 'partnerType', 'eventConfigurationItem_partnerType' - Partner type of the resource if the identifier type is PartnerAccountId.
newEventConfigurationItem ::
  EventConfigurationItem
newEventConfigurationItem :: EventConfigurationItem
newEventConfigurationItem =
  EventConfigurationItem'
    { $sel:events:EventConfigurationItem' :: Maybe EventNotificationItemConfigurations
events = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:EventConfigurationItem' :: Maybe Text
identifier = forall a. Maybe a
Prelude.Nothing,
      $sel:identifierType:EventConfigurationItem' :: Maybe IdentifierType
identifierType = forall a. Maybe a
Prelude.Nothing,
      $sel:partnerType:EventConfigurationItem' :: Maybe EventNotificationPartnerType
partnerType = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
eventConfigurationItem_events :: Lens.Lens' EventConfigurationItem (Prelude.Maybe EventNotificationItemConfigurations)
eventConfigurationItem_events :: Lens'
  EventConfigurationItem (Maybe EventNotificationItemConfigurations)
eventConfigurationItem_events = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventConfigurationItem' {Maybe EventNotificationItemConfigurations
events :: Maybe EventNotificationItemConfigurations
$sel:events:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationItemConfigurations
events} -> Maybe EventNotificationItemConfigurations
events) (\s :: EventConfigurationItem
s@EventConfigurationItem' {} Maybe EventNotificationItemConfigurations
a -> EventConfigurationItem
s {$sel:events:EventConfigurationItem' :: Maybe EventNotificationItemConfigurations
events = Maybe EventNotificationItemConfigurations
a} :: EventConfigurationItem)

-- | Resource identifier opted in for event messaging.
eventConfigurationItem_identifier :: Lens.Lens' EventConfigurationItem (Prelude.Maybe Prelude.Text)
eventConfigurationItem_identifier :: Lens' EventConfigurationItem (Maybe Text)
eventConfigurationItem_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventConfigurationItem' {Maybe Text
identifier :: Maybe Text
$sel:identifier:EventConfigurationItem' :: EventConfigurationItem -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: EventConfigurationItem
s@EventConfigurationItem' {} Maybe Text
a -> EventConfigurationItem
s {$sel:identifier:EventConfigurationItem' :: Maybe Text
identifier = Maybe Text
a} :: EventConfigurationItem)

-- | Identifier type of the particular resource identifier for event
-- configuration.
eventConfigurationItem_identifierType :: Lens.Lens' EventConfigurationItem (Prelude.Maybe IdentifierType)
eventConfigurationItem_identifierType :: Lens' EventConfigurationItem (Maybe IdentifierType)
eventConfigurationItem_identifierType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventConfigurationItem' {Maybe IdentifierType
identifierType :: Maybe IdentifierType
$sel:identifierType:EventConfigurationItem' :: EventConfigurationItem -> Maybe IdentifierType
identifierType} -> Maybe IdentifierType
identifierType) (\s :: EventConfigurationItem
s@EventConfigurationItem' {} Maybe IdentifierType
a -> EventConfigurationItem
s {$sel:identifierType:EventConfigurationItem' :: Maybe IdentifierType
identifierType = Maybe IdentifierType
a} :: EventConfigurationItem)

-- | Partner type of the resource if the identifier type is PartnerAccountId.
eventConfigurationItem_partnerType :: Lens.Lens' EventConfigurationItem (Prelude.Maybe EventNotificationPartnerType)
eventConfigurationItem_partnerType :: Lens' EventConfigurationItem (Maybe EventNotificationPartnerType)
eventConfigurationItem_partnerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventConfigurationItem' {Maybe EventNotificationPartnerType
partnerType :: Maybe EventNotificationPartnerType
$sel:partnerType:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationPartnerType
partnerType} -> Maybe EventNotificationPartnerType
partnerType) (\s :: EventConfigurationItem
s@EventConfigurationItem' {} Maybe EventNotificationPartnerType
a -> EventConfigurationItem
s {$sel:partnerType:EventConfigurationItem' :: Maybe EventNotificationPartnerType
partnerType = Maybe EventNotificationPartnerType
a} :: EventConfigurationItem)

instance Data.FromJSON EventConfigurationItem where
  parseJSON :: Value -> Parser EventConfigurationItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventConfigurationItem"
      ( \Object
x ->
          Maybe EventNotificationItemConfigurations
-> Maybe Text
-> Maybe IdentifierType
-> Maybe EventNotificationPartnerType
-> EventConfigurationItem
EventConfigurationItem'
            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
"Events")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Identifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentifierType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PartnerType")
      )

instance Prelude.Hashable EventConfigurationItem where
  hashWithSalt :: Int -> EventConfigurationItem -> Int
hashWithSalt Int
_salt EventConfigurationItem' {Maybe Text
Maybe EventNotificationPartnerType
Maybe IdentifierType
Maybe EventNotificationItemConfigurations
partnerType :: Maybe EventNotificationPartnerType
identifierType :: Maybe IdentifierType
identifier :: Maybe Text
events :: Maybe EventNotificationItemConfigurations
$sel:partnerType:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationPartnerType
$sel:identifierType:EventConfigurationItem' :: EventConfigurationItem -> Maybe IdentifierType
$sel:identifier:EventConfigurationItem' :: EventConfigurationItem -> Maybe Text
$sel:events:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationItemConfigurations
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationItemConfigurations
events
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentifierType
identifierType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventNotificationPartnerType
partnerType

instance Prelude.NFData EventConfigurationItem where
  rnf :: EventConfigurationItem -> ()
rnf EventConfigurationItem' {Maybe Text
Maybe EventNotificationPartnerType
Maybe IdentifierType
Maybe EventNotificationItemConfigurations
partnerType :: Maybe EventNotificationPartnerType
identifierType :: Maybe IdentifierType
identifier :: Maybe Text
events :: Maybe EventNotificationItemConfigurations
$sel:partnerType:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationPartnerType
$sel:identifierType:EventConfigurationItem' :: EventConfigurationItem -> Maybe IdentifierType
$sel:identifier:EventConfigurationItem' :: EventConfigurationItem -> Maybe Text
$sel:events:EventConfigurationItem' :: EventConfigurationItem -> Maybe EventNotificationItemConfigurations
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EventNotificationItemConfigurations
events
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentifierType
identifierType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventNotificationPartnerType
partnerType