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

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

-- | 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:/ 'newRequireCheckIn' smart constructor.
data RequireCheckIn = RequireCheckIn'
  { -- | Whether require check in is enabled or not.
    RequireCheckIn -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | Duration between 5 and 20 minutes to determine when to release the room
    -- if it\'s not checked into.
    RequireCheckIn -> Maybe Int
releaseAfterMinutes :: Prelude.Maybe Prelude.Int
  }
  deriving (RequireCheckIn -> RequireCheckIn -> Bool
(RequireCheckIn -> RequireCheckIn -> Bool)
-> (RequireCheckIn -> RequireCheckIn -> Bool) -> Eq RequireCheckIn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequireCheckIn -> RequireCheckIn -> Bool
$c/= :: RequireCheckIn -> RequireCheckIn -> Bool
== :: RequireCheckIn -> RequireCheckIn -> Bool
$c== :: RequireCheckIn -> RequireCheckIn -> Bool
Prelude.Eq, ReadPrec [RequireCheckIn]
ReadPrec RequireCheckIn
Int -> ReadS RequireCheckIn
ReadS [RequireCheckIn]
(Int -> ReadS RequireCheckIn)
-> ReadS [RequireCheckIn]
-> ReadPrec RequireCheckIn
-> ReadPrec [RequireCheckIn]
-> Read RequireCheckIn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequireCheckIn]
$creadListPrec :: ReadPrec [RequireCheckIn]
readPrec :: ReadPrec RequireCheckIn
$creadPrec :: ReadPrec RequireCheckIn
readList :: ReadS [RequireCheckIn]
$creadList :: ReadS [RequireCheckIn]
readsPrec :: Int -> ReadS RequireCheckIn
$creadsPrec :: Int -> ReadS RequireCheckIn
Prelude.Read, Int -> RequireCheckIn -> ShowS
[RequireCheckIn] -> ShowS
RequireCheckIn -> String
(Int -> RequireCheckIn -> ShowS)
-> (RequireCheckIn -> String)
-> ([RequireCheckIn] -> ShowS)
-> Show RequireCheckIn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequireCheckIn] -> ShowS
$cshowList :: [RequireCheckIn] -> ShowS
show :: RequireCheckIn -> String
$cshow :: RequireCheckIn -> String
showsPrec :: Int -> RequireCheckIn -> ShowS
$cshowsPrec :: Int -> RequireCheckIn -> ShowS
Prelude.Show, (forall x. RequireCheckIn -> Rep RequireCheckIn x)
-> (forall x. Rep RequireCheckIn x -> RequireCheckIn)
-> Generic RequireCheckIn
forall x. Rep RequireCheckIn x -> RequireCheckIn
forall x. RequireCheckIn -> Rep RequireCheckIn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequireCheckIn x -> RequireCheckIn
$cfrom :: forall x. RequireCheckIn -> Rep RequireCheckIn x
Prelude.Generic)

-- |
-- Create a value of 'RequireCheckIn' 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', 'requireCheckIn_enabled' - Whether require check in is enabled or not.
--
-- 'releaseAfterMinutes', 'requireCheckIn_releaseAfterMinutes' - Duration between 5 and 20 minutes to determine when to release the room
-- if it\'s not checked into.
newRequireCheckIn ::
  RequireCheckIn
newRequireCheckIn :: RequireCheckIn
newRequireCheckIn =
  RequireCheckIn' :: Maybe Bool -> Maybe Int -> RequireCheckIn
RequireCheckIn'
    { $sel:enabled:RequireCheckIn' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:releaseAfterMinutes:RequireCheckIn' :: Maybe Int
releaseAfterMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Core.FromJSON RequireCheckIn where
  parseJSON :: Value -> Parser RequireCheckIn
parseJSON =
    String
-> (Object -> Parser RequireCheckIn)
-> Value
-> Parser RequireCheckIn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RequireCheckIn"
      ( \Object
x ->
          Maybe Bool -> Maybe Int -> RequireCheckIn
RequireCheckIn'
            (Maybe Bool -> Maybe Int -> RequireCheckIn)
-> Parser (Maybe Bool) -> Parser (Maybe Int -> RequireCheckIn)
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 -> RequireCheckIn)
-> Parser (Maybe Int) -> Parser RequireCheckIn
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
"ReleaseAfterMinutes")
      )

instance Prelude.Hashable RequireCheckIn

instance Prelude.NFData RequireCheckIn