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

module Tesla.Car.Command.Doors (
  actuateFrontTrunk, actuateRearTrunk,
  lockDoors, unlockDoors
  ) where

import           Control.Monad.IO.Class (MonadIO (..))
import           Tesla.Car.Command

atr :: MonadIO m => String -> Car m CommandResponse
atr :: forall (m :: * -> *). MonadIO m => String -> Car m CommandResponse
atr String
w = forall (m :: * -> *).
MonadIO m =>
String -> [Pair] -> Car m CommandResponse
runCmd String
"actuate_trunk" [ Key
"which_trunk" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= String
w ]

actuateFrontTrunk :: MonadIO m => Car m CommandResponse
actuateFrontTrunk :: forall (m :: * -> *). MonadIO m => Car m CommandResponse
actuateFrontTrunk = forall (m :: * -> *). MonadIO m => String -> Car m CommandResponse
atr String
"front"

actuateRearTrunk :: MonadIO m => Car m CommandResponse
actuateRearTrunk :: forall (m :: * -> *). MonadIO m => Car m CommandResponse
actuateRearTrunk = forall (m :: * -> *). MonadIO m => String -> Car m CommandResponse
atr String
"rear"

mkNamedCommands [("lockDoors", "door_lock"),
                 ("unlockDoors", "door_unlock")]