<?php
declare(strict_types=1);

return function (\App\Core\Database $db): void {
    $exists = $db->selectOne(
        "SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'accounts'"
    );
    if (!$exists) {
        return;
    }
    $db->query(
        "INSERT INTO `accounts` (`code`, `name_ar`, `name_en`, `parent_code`, `level`, `account_type`, `is_header`, `is_active`, `created_at`)
        VALUES ('410503', 'إيراد حجز ساعي', 'Hourly Booking Revenue', '4105', 5, 'revenue', 0, 1, NOW())
        ON DUPLICATE KEY UPDATE `name_ar` = VALUES(`name_ar`)"
    );
};
