import { Controller, Get, Param } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { DeviceStatusService } from './device-status.service';

// Public and unauthenticated by design: a field device checks in by serial
// number alone (the same trust model already used for devices/<serial>/log
// MQTT ingestion) before any human has logged it into an org. The response
// only ever reveals a boolean + a short admin-written reason string.
@ApiTags('device-status (public)')
@Controller('devices')
export class DeviceStatusController {
  constructor(private readonly deviceStatusService: DeviceStatusService) {}

  @Get(':serial/status')
  getStatus(@Param('serial') serial: string) {
    return this.deviceStatusService.getStatus(serial);
  }
}
