{-# 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.AlexaBusiness.Types.InstantBooking
-- 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.AlexaBusiness.Types.InstantBooking where

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

-- | Settings for the instant booking feature that are applied to a room
-- profile. When users start their meeting with Alexa, Alexa automatically
-- books the room for the configured duration if the room is available.
--
-- /See:/ 'newInstantBooking' smart constructor.
data InstantBooking = InstantBooking'
  { -- | Whether instant booking is enabled or not.
    InstantBooking -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | Duration between 15 and 240 minutes at increments of 15 that determines
    -- how long to book an available room when a meeting is started with Alexa.
    InstantBooking -> Maybe Int
durationInMinutes :: Prelude.Maybe Prelude.Int
  }
  deriving (InstantBooking -> InstantBooking -> Bool
(InstantBooking -> InstantBooking -> Bool)
-> (InstantBooking -> InstantBooking -> Bool) -> Eq InstantBooking
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstantBooking -> InstantBooking -> Bool
$c/= :: InstantBooking -> InstantBooking -> Bool
== :: InstantBooking -> InstantBooking -> Bool
$c== :: InstantBooking -> InstantBooking -> Bool
Prelude.Eq, ReadPrec [InstantBooking]
ReadPrec InstantBooking
Int -> ReadS InstantBooking
ReadS [InstantBooking]
(Int -> ReadS InstantBooking)
-> ReadS [InstantBooking]
-> ReadPrec InstantBooking
-> ReadPrec [InstantBooking]
-> Read InstantBooking
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstantBooking]
$creadListPrec :: ReadPrec [InstantBooking]
readPrec :: ReadPrec InstantBooking
$creadPrec :: ReadPrec InstantBooking
readList :: ReadS [InstantBooking]
$creadList :: ReadS [InstantBooking]
readsPrec :: Int -> ReadS InstantBooking
$creadsPrec :: Int -> ReadS InstantBooking
Prelude.Read, Int -> InstantBooking -> ShowS
[InstantBooking] -> ShowS
InstantBooking -> String
(Int -> InstantBooking -> ShowS)
-> (InstantBooking -> String)
-> ([InstantBooking] -> ShowS)
-> Show InstantBooking
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstantBooking] -> ShowS
$cshowList :: [InstantBooking] -> ShowS
show :: InstantBooking -> String
$cshow :: InstantBooking -> String
showsPrec :: Int -> InstantBooking -> ShowS
$cshowsPrec :: Int -> InstantBooking -> ShowS
Prelude.Show, (forall x. InstantBooking -> Rep InstantBooking x)
-> (forall x. Rep InstantBooking x -> InstantBooking)
-> Generic InstantBooking
forall x. Rep InstantBooking x -> InstantBooking
forall x. InstantBooking -> Rep InstantBooking x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstantBooking x -> InstantBooking
$cfrom :: forall x. InstantBooking -> Rep InstantBooking x
Prelude.Generic)

-- |
-- Create a value of 'InstantBooking' 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:
--
-- 'enabled', 'instantBooking_enabled' - Whether instant booking is enabled or not.
--
-- 'durationInMinutes', 'instantBooking_durationInMinutes' - Duration between 15 and 240 minutes at increments of 15 that determines
-- how long to book an available room when a meeting is started with Alexa.
newInstantBooking ::
  InstantBooking
newInstantBooking :: InstantBooking
newInstantBooking =
  InstantBooking' :: Maybe Bool -> Maybe Int -> InstantBooking
InstantBooking'
    { $sel:enabled:InstantBooking' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:durationInMinutes:InstantBooking' :: Maybe Int
durationInMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether instant booking is enabled or not.
instantBooking_enabled :: Lens.Lens' InstantBooking (Prelude.Maybe Prelude.Bool)
instantBooking_enabled :: (Maybe Bool -> f (Maybe Bool))
-> InstantBooking -> f InstantBooking
instantBooking_enabled = (InstantBooking -> Maybe Bool)
-> (InstantBooking -> Maybe Bool -> InstantBooking)
-> Lens InstantBooking InstantBooking (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstantBooking' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:InstantBooking' :: InstantBooking -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: InstantBooking
s@InstantBooking' {} Maybe Bool
a -> InstantBooking
s {$sel:enabled:InstantBooking' :: Maybe Bool
enabled = Maybe Bool
a} :: InstantBooking)

-- | Duration between 15 and 240 minutes at increments of 15 that determines
-- how long to book an available room when a meeting is started with Alexa.
instantBooking_durationInMinutes :: Lens.Lens' InstantBooking (Prelude.Maybe Prelude.Int)
instantBooking_durationInMinutes :: (Maybe Int -> f (Maybe Int)) -> InstantBooking -> f InstantBooking
instantBooking_durationInMinutes = (InstantBooking -> Maybe Int)
-> (InstantBooking -> Maybe Int -> InstantBooking)
-> Lens InstantBooking InstantBooking (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstantBooking' {Maybe Int
durationInMinutes :: Maybe Int
$sel:durationInMinutes:InstantBooking' :: InstantBooking -> Maybe Int
durationInMinutes} -> Maybe Int
durationInMinutes) (\s :: InstantBooking
s@InstantBooking' {} Maybe Int
a -> InstantBooking
s {$sel:durationInMinutes:InstantBooking' :: Maybe Int
durationInMinutes = Maybe Int
a} :: InstantBooking)

instance Core.FromJSON InstantBooking where
  parseJSON :: Value -> Parser InstantBooking
parseJSON =
    String
-> (Object -> Parser InstantBooking)
-> Value
-> Parser InstantBooking
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstantBooking"
      ( \Object
x ->
          Maybe Bool -> Maybe Int -> InstantBooking
InstantBooking'
            (Maybe Bool -> Maybe Int -> InstantBooking)
-> Parser (Maybe Bool) -> Parser (Maybe Int -> InstantBooking)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
            Parser (Maybe Int -> InstantBooking)
-> Parser (Maybe Int) -> Parser InstantBooking
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
"DurationInMinutes")
      )

instance Prelude.Hashable InstantBooking

instance Prelude.NFData InstantBooking