Files
OnEverControl/frontend/src/api/hardwareApi.ts
T

30 lines
1.0 KiB
TypeScript

// ==============================================================================
// API de Hardware y Apertura Manual
// ==============================================================================
import { request } from './client';
export interface HardwareCommandResponse {
status: string;
modulo_id: number;
address: number;
payload: string;
message: string;
latencia_ms: number;
}
export const hardwareApi = {
manualOpen: (moduloId: number, motivo: string = 'APERTURA_MANUAL_GUARDIA', ticketId: number = 0) => {
return request<HardwareCommandResponse>(`/hardware/modules/${moduloId}/open`, {
method: 'POST',
body: JSON.stringify({ modulo_id: moduloId, motivo, ticket_id: ticketId }),
});
},
manualClose: (moduloId: number, motivo: string = 'CIERRE_FORZADO_GUARDIA', ticketId: number = 0) => {
return request<HardwareCommandResponse>(`/hardware/modules/${moduloId}/close`, {
method: 'POST',
body: JSON.stringify({ modulo_id: moduloId, motivo, ticket_id: ticketId }),
});
},
};