-- SMI Core Periods - OPTIONAL test access reset
-- Run only if you need known temporary credentials for staging/testing.
-- Temporary password for both admin and teacher:
-- SMI#7uQ2!mA9@2026
-- Change it immediately after the first successful login.

START TRANSACTION;

UPDATE `core_admins`
SET `password` = '$2y$12$3ut0QphG7ENWxB8KFr1HbOcMpfLKjN6I4qQAWeegWllEVwH.DBqoC',
    `status` = 'active',
    `updated_at` = NOW()
WHERE `email` = 'coreadmin@smi.com';

UPDATE `core_teachers`
SET `password` = '$2y$12$3ut0QphG7ENWxB8KFr1HbOcMpfLKjN6I4qQAWeegWllEVwH.DBqoC',
    `status` = 'active'
WHERE `email` = 'teacher@smi.com';

UPDATE `students`
SET `status` = 'approved',
    `core_status` = 'active',
    `student_code` = 'SMI-99999',
    `student_card` = 'SMI-ELD-220112',
    `student_card_number` = 'SMI-ELD-220112',
    `updated_at` = NOW()
WHERE `id` = 184 OR `student_code` = 'SMI-99999';

UPDATE `core_course_students`
SET `status` = 'active',
    `archive_status` = 'active',
    `archived_at` = NULL,
    `updated_at` = NOW()
WHERE `student_id` = (
    SELECT `id` FROM `students` WHERE `student_code` = 'SMI-99999' LIMIT 1
) AND `course_id` = 3;

COMMIT;
