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

module Tesla.Car.Command.Software (
  scheduleUpdate, cancelUpdate
  ) where

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

import           Tesla.Car.Command

-- | Schedule a software update in this many seconds.
scheduleUpdate :: MonadIO m => Int -> Car m CommandResponse
scheduleUpdate :: forall (m :: * -> *). MonadIO m => Int -> Car m CommandResponse
scheduleUpdate Int
secs = forall (m :: * -> *).
MonadIO m =>
String -> [Pair] -> Car m CommandResponse
runCmd String
"schedule_software_update" [Key
"offset_sec" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Int
secs]

-- | Cancel a scheduled software update.
mkCommand "cancelUpdate" "cancel_software_update"