<?php
declare(strict_types=1);
require_once __DIR__ . '/../../../app/Models/Customer.php';
require_once __DIR__ . '/../../../app/Config/functions.php';
require_login();

header('Content-Type: application/json');
$model = new Customer();

$success = $model->update((int)$_POST['id'], $_POST);
echo json_encode([
    'success' => $success,
    'message' => $success ? 'Customer updated successfully!' : 'Failed to update customer.'
]);
