import 'package:equatable/equatable.dart'; import '../../data/models/chatbot_rule_model.dart'; import '../../data/models/contact_model.dart'; import '../../data/models/plan_model.dart'; import '../../data/models/super_admin_stats_model.dart'; import '../../data/models/whatsapp_status_model.dart'; import '../../data/models/meta_session_model.dart'; // English: Enum representing the 9 tabs in the Nabeh web/mobile dashboard. // Arabic: قائمة تعداد تمثل الأبواب التسعة في لوحة تحكم نبيه على الويب والهاتف. enum DashboardTab { superAdmin, whatsapp, billing, contacts, templates, campaigns, chatbot, integrations, staff } class DashboardState extends Equatable { // English: The currently selected tab in navigation. // Arabic: الباب المحدد حالياً في التنقل. final DashboardTab activeTab; // English: Indicator if data is being retrieved from backend. // Arabic: مؤشر ما إذا كان يتم استرداد البيانات من الواجهة الخلفية. final bool isLoading; // English: Error message if API requests fail. // Arabic: رسالة الخطأ إذا فشلت طلبات واجهة برمجة التطبيقات. final String? errorMessage; // English: Feature data models parsed from network API responses. // Arabic: نماذج بيانات الميزات التي تم تحليلها من استجابات الشبكة. final WhatsAppStatusModel? whatsappStatus; final List plans; final List contacts; final List chatbotRules; final SuperAdminStatsModel? superAdminStats; final List metaSessions; const DashboardState({ required this.activeTab, required this.isLoading, this.errorMessage, this.whatsappStatus, this.plans = const [], this.contacts = const [], this.chatbotRules = const [], this.superAdminStats, this.metaSessions = const [], }); // English: Helper copyWith constructor to copy immutable state data safely. // Arabic: منشئ مساعد لنسخ بيانات الحالة الثابتة بشكل آمن. DashboardState copyWith({ DashboardTab? activeTab, bool? isLoading, String? errorMessage, WhatsAppStatusModel? whatsappStatus, List? plans, List? contacts, List? chatbotRules, SuperAdminStatsModel? superAdminStats, List? metaSessions, }) { return DashboardState( activeTab: activeTab ?? this.activeTab, isLoading: isLoading ?? this.isLoading, errorMessage: errorMessage, // Reset if null whatsappStatus: whatsappStatus ?? this.whatsappStatus, plans: plans ?? this.plans, contacts: contacts ?? this.contacts, chatbotRules: chatbotRules ?? this.chatbotRules, superAdminStats: superAdminStats ?? this.superAdminStats, metaSessions: metaSessions ?? this.metaSessions, ); } @override List get props => [ activeTab, isLoading, errorMessage, whatsappStatus, plans, contacts, chatbotRules, superAdminStats, metaSessions, ]; }