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

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

-- | Contains the configuration information of a snooze action.
--
-- /See:/ 'newSnoozeActionConfiguration' smart constructor.
data SnoozeActionConfiguration = SnoozeActionConfiguration'
  { -- | The note that you can leave when you snooze the alarm.
    SnoozeActionConfiguration -> Maybe Text
note :: Prelude.Maybe Prelude.Text,
    -- | The snooze time in seconds. The alarm automatically changes to the
    -- @NORMAL@ state after this duration.
    SnoozeActionConfiguration -> Maybe Int
snoozeDuration :: Prelude.Maybe Prelude.Int
  }
  deriving (SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool
(SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool)
-> (SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool)
-> Eq SnoozeActionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool
$c/= :: SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool
== :: SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool
$c== :: SnoozeActionConfiguration -> SnoozeActionConfiguration -> Bool
Prelude.Eq, ReadPrec [SnoozeActionConfiguration]
ReadPrec SnoozeActionConfiguration
Int -> ReadS SnoozeActionConfiguration
ReadS [SnoozeActionConfiguration]
(Int -> ReadS SnoozeActionConfiguration)
-> ReadS [SnoozeActionConfiguration]
-> ReadPrec SnoozeActionConfiguration
-> ReadPrec [SnoozeActionConfiguration]
-> Read SnoozeActionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnoozeActionConfiguration]
$creadListPrec :: ReadPrec [SnoozeActionConfiguration]
readPrec :: ReadPrec SnoozeActionConfiguration
$creadPrec :: ReadPrec SnoozeActionConfiguration
readList :: ReadS [SnoozeActionConfiguration]
$creadList :: ReadS [SnoozeActionConfiguration]
readsPrec :: Int -> ReadS SnoozeActionConfiguration
$creadsPrec :: Int -> ReadS SnoozeActionConfiguration
Prelude.Read, Int -> SnoozeActionConfiguration -> ShowS
[SnoozeActionConfiguration] -> ShowS
SnoozeActionConfiguration -> String
(Int -> SnoozeActionConfiguration -> ShowS)
-> (SnoozeActionConfiguration -> String)
-> ([SnoozeActionConfiguration] -> ShowS)
-> Show SnoozeActionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnoozeActionConfiguration] -> ShowS
$cshowList :: [SnoozeActionConfiguration] -> ShowS
show :: SnoozeActionConfiguration -> String
$cshow :: SnoozeActionConfiguration -> String
showsPrec :: Int -> SnoozeActionConfiguration -> ShowS
$cshowsPrec :: Int -> SnoozeActionConfiguration -> ShowS
Prelude.Show, (forall x.
 SnoozeActionConfiguration -> Rep SnoozeActionConfiguration x)
-> (forall x.
    Rep SnoozeActionConfiguration x -> SnoozeActionConfiguration)
-> Generic SnoozeActionConfiguration
forall x.
Rep SnoozeActionConfiguration x -> SnoozeActionConfiguration
forall x.
SnoozeActionConfiguration -> Rep SnoozeActionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SnoozeActionConfiguration x -> SnoozeActionConfiguration
$cfrom :: forall x.
SnoozeActionConfiguration -> Rep SnoozeActionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SnoozeActionConfiguration' 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:
--
-- 'note', 'snoozeActionConfiguration_note' - The note that you can leave when you snooze the alarm.
--
-- 'snoozeDuration', 'snoozeActionConfiguration_snoozeDuration' - The snooze time in seconds. The alarm automatically changes to the
-- @NORMAL@ state after this duration.
newSnoozeActionConfiguration ::
  SnoozeActionConfiguration
newSnoozeActionConfiguration :: SnoozeActionConfiguration
newSnoozeActionConfiguration =
  SnoozeActionConfiguration' :: Maybe Text -> Maybe Int -> SnoozeActionConfiguration
SnoozeActionConfiguration'
    { $sel:note:SnoozeActionConfiguration' :: Maybe Text
note = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snoozeDuration:SnoozeActionConfiguration' :: Maybe Int
snoozeDuration = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Prelude.Hashable SnoozeActionConfiguration

instance Prelude.NFData SnoozeActionConfiguration