{-# 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.CreateInstantBooking
-- 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.CreateInstantBooking where

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

-- | Creates 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:/ 'newCreateInstantBooking' smart constructor.
data CreateInstantBooking = CreateInstantBooking'
  { -- | 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.
    CreateInstantBooking -> Int
durationInMinutes :: Prelude.Int,
    -- | Whether instant booking is enabled or not.
    CreateInstantBooking -> Bool
enabled :: Prelude.Bool
  }
  deriving (CreateInstantBooking -> CreateInstantBooking -> Bool
(CreateInstantBooking -> CreateInstantBooking -> Bool)
-> (CreateInstantBooking -> CreateInstantBooking -> Bool)
-> Eq CreateInstantBooking
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstantBooking -> CreateInstantBooking -> Bool
$c/= :: CreateInstantBooking -> CreateInstantBooking -> Bool
== :: CreateInstantBooking -> CreateInstantBooking -> Bool
$c== :: CreateInstantBooking -> CreateInstantBooking -> Bool
Prelude.Eq, ReadPrec [CreateInstantBooking]
ReadPrec CreateInstantBooking
Int -> ReadS CreateInstantBooking
ReadS [CreateInstantBooking]
(Int -> ReadS CreateInstantBooking)
-> ReadS [CreateInstantBooking]
-> ReadPrec CreateInstantBooking
-> ReadPrec [CreateInstantBooking]
-> Read CreateInstantBooking
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstantBooking]
$creadListPrec :: ReadPrec [CreateInstantBooking]
readPrec :: ReadPrec CreateInstantBooking
$creadPrec :: ReadPrec CreateInstantBooking
readList :: ReadS [CreateInstantBooking]
$creadList :: ReadS [CreateInstantBooking]
readsPrec :: Int -> ReadS CreateInstantBooking
$creadsPrec :: Int -> ReadS CreateInstantBooking
Prelude.Read, Int -> CreateInstantBooking -> ShowS
[CreateInstantBooking] -> ShowS
CreateInstantBooking -> String
(Int -> CreateInstantBooking -> ShowS)
-> (CreateInstantBooking -> String)
-> ([CreateInstantBooking] -> ShowS)
-> Show CreateInstantBooking
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstantBooking] -> ShowS
$cshowList :: [CreateInstantBooking] -> ShowS
show :: CreateInstantBooking -> String
$cshow :: CreateInstantBooking -> String
showsPrec :: Int -> CreateInstantBooking -> ShowS
$cshowsPrec :: Int -> CreateInstantBooking -> ShowS
Prelude.Show, (forall x. CreateInstantBooking -> Rep CreateInstantBooking x)
-> (forall x. Rep CreateInstantBooking x -> CreateInstantBooking)
-> Generic CreateInstantBooking
forall x. Rep CreateInstantBooking x -> CreateInstantBooking
forall x. CreateInstantBooking -> Rep CreateInstantBooking x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateInstantBooking x -> CreateInstantBooking
$cfrom :: forall x. CreateInstantBooking -> Rep CreateInstantBooking x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstantBooking' 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:
--
-- 'durationInMinutes', 'createInstantBooking_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.
--
-- 'enabled', 'createInstantBooking_enabled' - Whether instant booking is enabled or not.
newCreateInstantBooking ::
  -- | 'durationInMinutes'
  Prelude.Int ->
  -- | 'enabled'
  Prelude.Bool ->
  CreateInstantBooking
newCreateInstantBooking :: Int -> Bool -> CreateInstantBooking
newCreateInstantBooking Int
pDurationInMinutes_ Bool
pEnabled_ =
  CreateInstantBooking' :: Int -> Bool -> CreateInstantBooking
CreateInstantBooking'
    { $sel:durationInMinutes:CreateInstantBooking' :: Int
durationInMinutes =
        Int
pDurationInMinutes_,
      $sel:enabled:CreateInstantBooking' :: Bool
enabled = Bool
pEnabled_
    }

-- | 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.
createInstantBooking_durationInMinutes :: Lens.Lens' CreateInstantBooking Prelude.Int
createInstantBooking_durationInMinutes :: (Int -> f Int) -> CreateInstantBooking -> f CreateInstantBooking
createInstantBooking_durationInMinutes = (CreateInstantBooking -> Int)
-> (CreateInstantBooking -> Int -> CreateInstantBooking)
-> Lens CreateInstantBooking CreateInstantBooking Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstantBooking' {Int
durationInMinutes :: Int
$sel:durationInMinutes:CreateInstantBooking' :: CreateInstantBooking -> Int
durationInMinutes} -> Int
durationInMinutes) (\s :: CreateInstantBooking
s@CreateInstantBooking' {} Int
a -> CreateInstantBooking
s {$sel:durationInMinutes:CreateInstantBooking' :: Int
durationInMinutes = Int
a} :: CreateInstantBooking)

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

instance Prelude.Hashable CreateInstantBooking

instance Prelude.NFData CreateInstantBooking

instance Core.ToJSON CreateInstantBooking where
  toJSON :: CreateInstantBooking -> Value
toJSON CreateInstantBooking' {Bool
Int
enabled :: Bool
durationInMinutes :: Int
$sel:enabled:CreateInstantBooking' :: CreateInstantBooking -> Bool
$sel:durationInMinutes:CreateInstantBooking' :: CreateInstantBooking -> Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DurationInMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
durationInMinutes),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enabled)
          ]
      )