#ifndef LAMP_UI_WIRE_SERVICE_H
#define LAMP_UI_WIRE_SERVICE_H

#include "ai_wire.h"
#include "lamp_ui_dispatch.h"

typedef struct {
    lg_guard *guard;
    lamp_ui_dispatcher dispatcher;
    bool session_open;
    uint32_t session_open_count;
    uint32_t rejected_session_count;
    uint32_t command_count;
} lamp_ui_wire_service;

/* The enclosing target owns the guard and serializes all service calls. */
bool lamp_ui_wire_service_init(lamp_ui_wire_service *service, lg_guard *guard);

/* Handle one decoded UI session or command message and prepare its wire ACK. */
bool lamp_ui_wire_service_handle(lamp_ui_wire_service *service,
                                 const aiw_message *message, uint32_t now_ms,
                                 aiw_ui_ack *ack);

#endif
