{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}

module Tesla.Car.Command.Valet (
  setValetMode, clearValetPIN
  ) where

import           Control.Monad.IO.Class (MonadIO (..))

import           Tesla.Car.Command

-- | Enable valet mode with a four digit pin.
setValetMode :: MonadIO m => Bool -> Int -> Car m CommandResponse
setValetMode :: forall (m :: * -> *).
MonadIO m =>
Bool -> Int -> Car m CommandResponse
setValetMode Bool
on Int
pin = forall (m :: * -> *).
MonadIO m =>
String -> [Pair] -> Car m CommandResponse
runCmd String
"set_valet_mode" [ Key
"on" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool
on, Key
"password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Int
pin]

mkCommand "clearValetPIN" "reset_valet_pin"