// Models/menu.dart class Menu { final int? id; final String title; final String icon; final String route; final int orderIndex; final bool isActive; final int? parentId; Menu({ this.id, required this.title, required this.icon, required this.route, this.orderIndex = 0, this.isActive = true, this.parentId, }); Map toMap() { return { 'id': id, 'title': title, 'icon': icon, 'route': route, 'order_index': orderIndex, 'is_active': isActive ? 1 : 0, 'parent_id': parentId, }; } factory Menu.fromMap(Map map) { return Menu( id: map['id']?.toInt(), title: map['title'] ?? '', icon: map['icon'] ?? '', route: map['route'] ?? '', orderIndex: map['order_index']?.toInt() ?? 0, isActive: (map['is_active'] ?? 1) == 1, parentId: map['parent_id']?.toInt(), ); } Menu copyWith({ int? id, String? title, String? icon, String? route, int? orderIndex, bool? isActive, int? parentId, }) { return Menu( id: id ?? this.id, title: title ?? this.title, icon: icon ?? this.icon, route: route ?? this.route, orderIndex: orderIndex ?? this.orderIndex, isActive: isActive ?? this.isActive, parentId: parentId ?? this.parentId, ); } @override String toString() { return 'Menu(id: $id, title: $title, icon: $icon, route: $route, orderIndex: $orderIndex, isActive: $isActive, parentId: $parentId)'; } @override bool operator ==(Object other) { if (identical(this, other)) return true; return other is Menu && other.id == id && other.title == title && other.icon == icon && other.route == route && other.orderIndex == orderIndex && other.isActive == isActive && other.parentId == parentId; } @override int get hashCode { return id.hashCode ^ title.hashCode ^ icon.hashCode ^ route.hashCode ^ orderIndex.hashCode ^ isActive.hashCode ^ parentId.hashCode; } }