// HTTPS client for the SMASHR device API. Every request after pairing is HMAC-SHA256 signed:
//   sig = hex(HMAC_SHA256(secret, ts + "." + nonce + "." + body))
// headers: x-sendit-device, x-sendit-ts, x-sendit-nonce, x-sendit-sig
#pragma once
#include <Arduino.h>

struct PressResult {
  String code;      // ok | cooldown | insufficient | error
  String reason;
  uint32_t retryIn; // seconds, for cooldown
  bool transport;   // true when the request never got an answer
};

namespace api {
  void setIdentity(const String& deviceId, const String& secret);
  bool pair(const String& code, String& deviceId, String& secret, String& err);
  PressResult press(uint32_t seq);
  bool ping(String& otaUrl, String& otaVersion);
  int64_t serverTime();
}
