{-# 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.IoTEventsData.Types.SnoozeAlarmActionRequest
-- 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.IoTEventsData.Types.SnoozeAlarmActionRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information needed to snooze the alarm.
--
-- /See:/ 'newSnoozeAlarmActionRequest' smart constructor.
data SnoozeAlarmActionRequest = SnoozeAlarmActionRequest'
  { -- | The value of the key used as a filter to select only the alarms
    -- associated with the
    -- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
    SnoozeAlarmActionRequest -> Maybe Text
keyValue :: Prelude.Maybe Prelude.Text,
    -- | The note that you can leave when you snooze the alarm.
    SnoozeAlarmActionRequest -> Maybe Text
note :: Prelude.Maybe Prelude.Text,
    -- | The request ID. Each ID must be unique within each batch.
    SnoozeAlarmActionRequest -> Text
requestId :: Prelude.Text,
    -- | The name of the alarm model.
    SnoozeAlarmActionRequest -> Text
alarmModelName :: Prelude.Text,
    -- | The snooze time in seconds. The alarm automatically changes to the
    -- @NORMAL@ state after this duration.
    SnoozeAlarmActionRequest -> Int
snoozeDuration :: Prelude.Int
  }
  deriving (SnoozeAlarmActionRequest -> SnoozeAlarmActionRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnoozeAlarmActionRequest -> SnoozeAlarmActionRequest -> Bool
$c/= :: SnoozeAlarmActionRequest -> SnoozeAlarmActionRequest -> Bool
== :: SnoozeAlarmActionRequest -> SnoozeAlarmActionRequest -> Bool
$c== :: SnoozeAlarmActionRequest -> SnoozeAlarmActionRequest -> Bool
Prelude.Eq, ReadPrec [SnoozeAlarmActionRequest]
ReadPrec SnoozeAlarmActionRequest
Int -> ReadS SnoozeAlarmActionRequest
ReadS [SnoozeAlarmActionRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnoozeAlarmActionRequest]
$creadListPrec :: ReadPrec [SnoozeAlarmActionRequest]
readPrec :: ReadPrec SnoozeAlarmActionRequest
$creadPrec :: ReadPrec SnoozeAlarmActionRequest
readList :: ReadS [SnoozeAlarmActionRequest]
$creadList :: ReadS [SnoozeAlarmActionRequest]
readsPrec :: Int -> ReadS SnoozeAlarmActionRequest
$creadsPrec :: Int -> ReadS SnoozeAlarmActionRequest
Prelude.Read, Int -> SnoozeAlarmActionRequest -> ShowS
[SnoozeAlarmActionRequest] -> ShowS
SnoozeAlarmActionRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnoozeAlarmActionRequest] -> ShowS
$cshowList :: [SnoozeAlarmActionRequest] -> ShowS
show :: SnoozeAlarmActionRequest -> String
$cshow :: SnoozeAlarmActionRequest -> String
showsPrec :: Int -> SnoozeAlarmActionRequest -> ShowS
$cshowsPrec :: Int -> SnoozeAlarmActionRequest -> ShowS
Prelude.Show, forall x.
Rep SnoozeAlarmActionRequest x -> SnoozeAlarmActionRequest
forall x.
SnoozeAlarmActionRequest -> Rep SnoozeAlarmActionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SnoozeAlarmActionRequest x -> SnoozeAlarmActionRequest
$cfrom :: forall x.
SnoozeAlarmActionRequest -> Rep SnoozeAlarmActionRequest x
Prelude.Generic)

-- |
-- Create a value of 'SnoozeAlarmActionRequest' 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:
--
-- 'keyValue', 'snoozeAlarmActionRequest_keyValue' - The value of the key used as a filter to select only the alarms
-- associated with the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
--
-- 'note', 'snoozeAlarmActionRequest_note' - The note that you can leave when you snooze the alarm.
--
-- 'requestId', 'snoozeAlarmActionRequest_requestId' - The request ID. Each ID must be unique within each batch.
--
-- 'alarmModelName', 'snoozeAlarmActionRequest_alarmModelName' - The name of the alarm model.
--
-- 'snoozeDuration', 'snoozeAlarmActionRequest_snoozeDuration' - The snooze time in seconds. The alarm automatically changes to the
-- @NORMAL@ state after this duration.
newSnoozeAlarmActionRequest ::
  -- | 'requestId'
  Prelude.Text ->
  -- | 'alarmModelName'
  Prelude.Text ->
  -- | 'snoozeDuration'
  Prelude.Int ->
  SnoozeAlarmActionRequest
newSnoozeAlarmActionRequest :: Text -> Text -> Int -> SnoozeAlarmActionRequest
newSnoozeAlarmActionRequest
  Text
pRequestId_
  Text
pAlarmModelName_
  Int
pSnoozeDuration_ =
    SnoozeAlarmActionRequest'
      { $sel:keyValue:SnoozeAlarmActionRequest' :: Maybe Text
keyValue =
          forall a. Maybe a
Prelude.Nothing,
        $sel:note:SnoozeAlarmActionRequest' :: Maybe Text
note = forall a. Maybe a
Prelude.Nothing,
        $sel:requestId:SnoozeAlarmActionRequest' :: Text
requestId = Text
pRequestId_,
        $sel:alarmModelName:SnoozeAlarmActionRequest' :: Text
alarmModelName = Text
pAlarmModelName_,
        $sel:snoozeDuration:SnoozeAlarmActionRequest' :: Int
snoozeDuration = Int
pSnoozeDuration_
      }

-- | The value of the key used as a filter to select only the alarms
-- associated with the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
snoozeAlarmActionRequest_keyValue :: Lens.Lens' SnoozeAlarmActionRequest (Prelude.Maybe Prelude.Text)
snoozeAlarmActionRequest_keyValue :: Lens' SnoozeAlarmActionRequest (Maybe Text)
snoozeAlarmActionRequest_keyValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnoozeAlarmActionRequest' {Maybe Text
keyValue :: Maybe Text
$sel:keyValue:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
keyValue} -> Maybe Text
keyValue) (\s :: SnoozeAlarmActionRequest
s@SnoozeAlarmActionRequest' {} Maybe Text
a -> SnoozeAlarmActionRequest
s {$sel:keyValue:SnoozeAlarmActionRequest' :: Maybe Text
keyValue = Maybe Text
a} :: SnoozeAlarmActionRequest)

-- | The note that you can leave when you snooze the alarm.
snoozeAlarmActionRequest_note :: Lens.Lens' SnoozeAlarmActionRequest (Prelude.Maybe Prelude.Text)
snoozeAlarmActionRequest_note :: Lens' SnoozeAlarmActionRequest (Maybe Text)
snoozeAlarmActionRequest_note = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnoozeAlarmActionRequest' {Maybe Text
note :: Maybe Text
$sel:note:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
note} -> Maybe Text
note) (\s :: SnoozeAlarmActionRequest
s@SnoozeAlarmActionRequest' {} Maybe Text
a -> SnoozeAlarmActionRequest
s {$sel:note:SnoozeAlarmActionRequest' :: Maybe Text
note = Maybe Text
a} :: SnoozeAlarmActionRequest)

-- | The request ID. Each ID must be unique within each batch.
snoozeAlarmActionRequest_requestId :: Lens.Lens' SnoozeAlarmActionRequest Prelude.Text
snoozeAlarmActionRequest_requestId :: Lens' SnoozeAlarmActionRequest Text
snoozeAlarmActionRequest_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnoozeAlarmActionRequest' {Text
requestId :: Text
$sel:requestId:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
requestId} -> Text
requestId) (\s :: SnoozeAlarmActionRequest
s@SnoozeAlarmActionRequest' {} Text
a -> SnoozeAlarmActionRequest
s {$sel:requestId:SnoozeAlarmActionRequest' :: Text
requestId = Text
a} :: SnoozeAlarmActionRequest)

-- | The name of the alarm model.
snoozeAlarmActionRequest_alarmModelName :: Lens.Lens' SnoozeAlarmActionRequest Prelude.Text
snoozeAlarmActionRequest_alarmModelName :: Lens' SnoozeAlarmActionRequest Text
snoozeAlarmActionRequest_alarmModelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnoozeAlarmActionRequest' {Text
alarmModelName :: Text
$sel:alarmModelName:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
alarmModelName} -> Text
alarmModelName) (\s :: SnoozeAlarmActionRequest
s@SnoozeAlarmActionRequest' {} Text
a -> SnoozeAlarmActionRequest
s {$sel:alarmModelName:SnoozeAlarmActionRequest' :: Text
alarmModelName = Text
a} :: SnoozeAlarmActionRequest)

-- | The snooze time in seconds. The alarm automatically changes to the
-- @NORMAL@ state after this duration.
snoozeAlarmActionRequest_snoozeDuration :: Lens.Lens' SnoozeAlarmActionRequest Prelude.Int
snoozeAlarmActionRequest_snoozeDuration :: Lens' SnoozeAlarmActionRequest Int
snoozeAlarmActionRequest_snoozeDuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnoozeAlarmActionRequest' {Int
snoozeDuration :: Int
$sel:snoozeDuration:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Int
snoozeDuration} -> Int
snoozeDuration) (\s :: SnoozeAlarmActionRequest
s@SnoozeAlarmActionRequest' {} Int
a -> SnoozeAlarmActionRequest
s {$sel:snoozeDuration:SnoozeAlarmActionRequest' :: Int
snoozeDuration = Int
a} :: SnoozeAlarmActionRequest)

instance Prelude.Hashable SnoozeAlarmActionRequest where
  hashWithSalt :: Int -> SnoozeAlarmActionRequest -> Int
hashWithSalt Int
_salt SnoozeAlarmActionRequest' {Int
Maybe Text
Text
snoozeDuration :: Int
alarmModelName :: Text
requestId :: Text
note :: Maybe Text
keyValue :: Maybe Text
$sel:snoozeDuration:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Int
$sel:alarmModelName:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:requestId:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:note:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
$sel:keyValue:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
note
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
requestId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alarmModelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
snoozeDuration

instance Prelude.NFData SnoozeAlarmActionRequest where
  rnf :: SnoozeAlarmActionRequest -> ()
rnf SnoozeAlarmActionRequest' {Int
Maybe Text
Text
snoozeDuration :: Int
alarmModelName :: Text
requestId :: Text
note :: Maybe Text
keyValue :: Maybe Text
$sel:snoozeDuration:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Int
$sel:alarmModelName:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:requestId:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:note:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
$sel:keyValue:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
note
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alarmModelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
snoozeDuration

instance Data.ToJSON SnoozeAlarmActionRequest where
  toJSON :: SnoozeAlarmActionRequest -> Value
toJSON SnoozeAlarmActionRequest' {Int
Maybe Text
Text
snoozeDuration :: Int
alarmModelName :: Text
requestId :: Text
note :: Maybe Text
keyValue :: Maybe Text
$sel:snoozeDuration:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Int
$sel:alarmModelName:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:requestId:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Text
$sel:note:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
$sel:keyValue:SnoozeAlarmActionRequest' :: SnoozeAlarmActionRequest -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"keyValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
keyValue,
            (Key
"note" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
note,
            forall a. a -> Maybe a
Prelude.Just (Key
"requestId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
requestId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"alarmModelName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alarmModelName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"snoozeDuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
snoozeDuration)
          ]
      )