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

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

-- | Creates settings for the require check in feature that are applied to a
-- room profile. Require check in allows a meeting room’s Alexa or AVS
-- device to prompt the user to check in; otherwise, the room will be
-- released.
--
-- /See:/ 'newCreateRequireCheckIn' smart constructor.
data CreateRequireCheckIn = CreateRequireCheckIn'
  { -- | Duration between 5 and 20 minutes to determine when to release the room
    -- if it\'s not checked into.
    CreateRequireCheckIn -> Int
releaseAfterMinutes :: Prelude.Int,
    -- | Whether require check in is enabled or not.
    CreateRequireCheckIn -> Bool
enabled :: Prelude.Bool
  }
  deriving (CreateRequireCheckIn -> CreateRequireCheckIn -> Bool
(CreateRequireCheckIn -> CreateRequireCheckIn -> Bool)
-> (CreateRequireCheckIn -> CreateRequireCheckIn -> Bool)
-> Eq CreateRequireCheckIn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRequireCheckIn -> CreateRequireCheckIn -> Bool
$c/= :: CreateRequireCheckIn -> CreateRequireCheckIn -> Bool
== :: CreateRequireCheckIn -> CreateRequireCheckIn -> Bool
$c== :: CreateRequireCheckIn -> CreateRequireCheckIn -> Bool
Prelude.Eq, ReadPrec [CreateRequireCheckIn]
ReadPrec CreateRequireCheckIn
Int -> ReadS CreateRequireCheckIn
ReadS [CreateRequireCheckIn]
(Int -> ReadS CreateRequireCheckIn)
-> ReadS [CreateRequireCheckIn]
-> ReadPrec CreateRequireCheckIn
-> ReadPrec [CreateRequireCheckIn]
-> Read CreateRequireCheckIn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRequireCheckIn]
$creadListPrec :: ReadPrec [CreateRequireCheckIn]
readPrec :: ReadPrec CreateRequireCheckIn
$creadPrec :: ReadPrec CreateRequireCheckIn
readList :: ReadS [CreateRequireCheckIn]
$creadList :: ReadS [CreateRequireCheckIn]
readsPrec :: Int -> ReadS CreateRequireCheckIn
$creadsPrec :: Int -> ReadS CreateRequireCheckIn
Prelude.Read, Int -> CreateRequireCheckIn -> ShowS
[CreateRequireCheckIn] -> ShowS
CreateRequireCheckIn -> String
(Int -> CreateRequireCheckIn -> ShowS)
-> (CreateRequireCheckIn -> String)
-> ([CreateRequireCheckIn] -> ShowS)
-> Show CreateRequireCheckIn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRequireCheckIn] -> ShowS
$cshowList :: [CreateRequireCheckIn] -> ShowS
show :: CreateRequireCheckIn -> String
$cshow :: CreateRequireCheckIn -> String
showsPrec :: Int -> CreateRequireCheckIn -> ShowS
$cshowsPrec :: Int -> CreateRequireCheckIn -> ShowS
Prelude.Show, (forall x. CreateRequireCheckIn -> Rep CreateRequireCheckIn x)
-> (forall x. Rep CreateRequireCheckIn x -> CreateRequireCheckIn)
-> Generic CreateRequireCheckIn
forall x. Rep CreateRequireCheckIn x -> CreateRequireCheckIn
forall x. CreateRequireCheckIn -> Rep CreateRequireCheckIn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRequireCheckIn x -> CreateRequireCheckIn
$cfrom :: forall x. CreateRequireCheckIn -> Rep CreateRequireCheckIn x
Prelude.Generic)

-- |
-- Create a value of 'CreateRequireCheckIn' 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:
--
-- 'releaseAfterMinutes', 'createRequireCheckIn_releaseAfterMinutes' - Duration between 5 and 20 minutes to determine when to release the room
-- if it\'s not checked into.
--
-- 'enabled', 'createRequireCheckIn_enabled' - Whether require check in is enabled or not.
newCreateRequireCheckIn ::
  -- | 'releaseAfterMinutes'
  Prelude.Int ->
  -- | 'enabled'
  Prelude.Bool ->
  CreateRequireCheckIn
newCreateRequireCheckIn :: Int -> Bool -> CreateRequireCheckIn
newCreateRequireCheckIn
  Int
pReleaseAfterMinutes_
  Bool
pEnabled_ =
    CreateRequireCheckIn' :: Int -> Bool -> CreateRequireCheckIn
CreateRequireCheckIn'
      { $sel:releaseAfterMinutes:CreateRequireCheckIn' :: Int
releaseAfterMinutes =
          Int
pReleaseAfterMinutes_,
        $sel:enabled:CreateRequireCheckIn' :: Bool
enabled = Bool
pEnabled_
      }

-- | Duration between 5 and 20 minutes to determine when to release the room
-- if it\'s not checked into.
createRequireCheckIn_releaseAfterMinutes :: Lens.Lens' CreateRequireCheckIn Prelude.Int
createRequireCheckIn_releaseAfterMinutes :: (Int -> f Int) -> CreateRequireCheckIn -> f CreateRequireCheckIn
createRequireCheckIn_releaseAfterMinutes = (CreateRequireCheckIn -> Int)
-> (CreateRequireCheckIn -> Int -> CreateRequireCheckIn)
-> Lens CreateRequireCheckIn CreateRequireCheckIn Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRequireCheckIn' {Int
releaseAfterMinutes :: Int
$sel:releaseAfterMinutes:CreateRequireCheckIn' :: CreateRequireCheckIn -> Int
releaseAfterMinutes} -> Int
releaseAfterMinutes) (\s :: CreateRequireCheckIn
s@CreateRequireCheckIn' {} Int
a -> CreateRequireCheckIn
s {$sel:releaseAfterMinutes:CreateRequireCheckIn' :: Int
releaseAfterMinutes = Int
a} :: CreateRequireCheckIn)

-- | Whether require check in is enabled or not.
createRequireCheckIn_enabled :: Lens.Lens' CreateRequireCheckIn Prelude.Bool
createRequireCheckIn_enabled :: (Bool -> f Bool) -> CreateRequireCheckIn -> f CreateRequireCheckIn
createRequireCheckIn_enabled = (CreateRequireCheckIn -> Bool)
-> (CreateRequireCheckIn -> Bool -> CreateRequireCheckIn)
-> Lens CreateRequireCheckIn CreateRequireCheckIn Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRequireCheckIn' {Bool
enabled :: Bool
$sel:enabled:CreateRequireCheckIn' :: CreateRequireCheckIn -> Bool
enabled} -> Bool
enabled) (\s :: CreateRequireCheckIn
s@CreateRequireCheckIn' {} Bool
a -> CreateRequireCheckIn
s {$sel:enabled:CreateRequireCheckIn' :: Bool
enabled = Bool
a} :: CreateRequireCheckIn)

instance Prelude.Hashable CreateRequireCheckIn

instance Prelude.NFData CreateRequireCheckIn

instance Core.ToJSON CreateRequireCheckIn where
  toJSON :: CreateRequireCheckIn -> Value
toJSON CreateRequireCheckIn' {Bool
Int
enabled :: Bool
releaseAfterMinutes :: Int
$sel:enabled:CreateRequireCheckIn' :: CreateRequireCheckIn -> Bool
$sel:releaseAfterMinutes:CreateRequireCheckIn' :: CreateRequireCheckIn -> 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
"ReleaseAfterMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
releaseAfterMinutes),
            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)
          ]
      )