<?php
// api_status.php
header('Content-Type: application/json');

$path = 'C:/opscode/fss3xp.txt';
if (!file_exists($path)) {
  echo json_encode(['error'=>'status file not found']);
  exit;
}

$status = trim(file_get_contents($path));
$map = [
  'IDELL'    => 'surtidor_300x300.jpg',
  'CALLING' => 'surtidor_naranja.jpg',
  'STARTING'=> 'surtidor_naranja.jpg',
  'FUELLING'=> 'surtidor_azul.jpg',
  'CLOSED'  => 'surtidor_rojo.jpg'
];

echo json_encode([
  'status'=>$status,
  'image'=>$map[$status] ?? 'surtidor_300x300.jpg'
]);
