#ifndef SINRIC_MANAGER_H
#define SINRIC_MANAGER_H

#include <Arduino.h>

// Sinric Pro integration for Google Home / Alexa voice control of blinds.
// Uses SinricProBlinds device type which supports position control (0-100%).
// 
// Supported voice commands:
//   - "Hey Google, open/close the [device name]"
//   - "Hey Google, set [device name] to 50%"
//   - "Hey Google, open the [device name] a little"

class SinricManager {
public:
  SinricManager();

  // Initialize Sinric Pro connection (call in setup)
  void begin();

  // Process Sinric Pro WebSocket events (call in loop)
  void update();

  // Report blinds position to Sinric Pro cloud (0-100%).
  // Call this whenever position changes from local/MQTT/touch control
  // so Google Home stays in sync.
  void reportPosition(int position);

  // Connection status
  bool isConnected() const { return _connected; }

  // Allow callbacks to set connection state
  void setConnected(bool connected) { _connected = connected; }

private:
  bool _connected;
  int  _lastReportedPosition;
  bool _initialized;
  unsigned long _lastHandleTime; // Rate-limit SinricPro.handle() calls
};

extern SinricManager sinricManager;

#endif
