<?php
// api/endpoints/siswa_put.php

if (empty($body['id'])) respond(['status'=>'error','message'=>'id wajib diisi'], 400);

$upd = $pdo->prepare("
    UPDATE siswa SET nama=?, kelas=?, jurusan=?, tahun_ajaran=?, no_hp=?, alamat=?
    WHERE id=?
");
$upd->execute([
    $body['nama']        ?? '',
    $body['kelas']       ?? '',
    $body['jurusan']     ?? '',
    $body['tahunAjaran'] ?? '',
    $body['noHp']        ?? '',
    $body['alamat']      ?? '',
    (int)$body['id']
]);

respond(['status' => 'success', 'updated' => true]);