// ملف: smart_home.dart import 'dart:io'; void main() { bool lightsOn = false; int temperature = 20; bool securityOn = false; while (true) { print('\n--- المنزل الذكي ---'); print('1. تشغيل/إطفاء الأضواء'); print('2. تغيير درجة الحرارة'); print('3. تفعيل/إيقاف الأمان'); print('4. عرض الحالة'); print('5. خروج'); stdout.write('اختر رقم: '); var choice = stdin.readLineSync(); switch (choice) { case '1': lightsOn = !lightsOn; print('الأضواء: ${lightsOn ? 'مشغلة' : 'مطفأة'}'); break; case '2': stdout.write('ادخل درجة الحرارة (15-30): '); var temp = stdin.readLineSync(); var newTemp = int.tryParse(temp ?? ''); if (newTemp != null && newTemp >= 15 && newTemp <= 30) { temperature = newTemp; print('تم الضبط على: $temperature°م'); } else { print('رقم غير صحيح!'); } break; case '3': securityOn = !securityOn; print('نظام الأمان: ${securityOn ? 'مفعل' : 'معطل'}'); break; case '4': print('\nالحالة الحالية:'); print('- الأضواء: ${lightsOn ? 'مشغلة' : 'مطفأة'}'); print('- درجة الحرارة: $temperature°م'); if (temperature % 3 == 0 && temperature % 5 == 0) { print(' → Perfect Day!'); } else if (temperature % 3 == 0) { print(' → Cool Day'); } else if (temperature % 5 == 0) { print(' → Warm Day'); } print('- الأمان: ${securityOn ? 'مفعل' : 'معطل'}'.toUpperCase()); break; case '5': print('مع السلامة! 👋'); return; default: print('اختيار خاطئ!'); } } }