import '../../core/hub/hub_client.dart'; class WaiterNotification { WaiterNotification({ required this.id, required this.type, required this.title, this.body, this.tableNumber, this.referenceId, required this.createdAt, this.isRead = false, }); final String id; final String type; final String title; final String? body; final String? tableNumber; final String? referenceId; final DateTime createdAt; bool isRead; factory WaiterNotification.fromHub(HubNotification n) => WaiterNotification( id: n.id, type: n.type, title: n.title, body: n.body, tableNumber: n.tableNumber, referenceId: n.referenceId, createdAt: n.createdAt, ); factory WaiterNotification.fromJson(Map json) => WaiterNotification( id: json['id'] as String, type: json['type'] as String, title: json['title'] as String, body: json['body'] as String?, tableNumber: json['tableNumber'] as String?, referenceId: json['referenceId'] as String?, createdAt: DateTime.tryParse(json['createdAt'] as String? ?? '') ?? DateTime.now(), isRead: json['isRead'] as bool? ?? false, ); bool get isCallWaiter => type == 'table_call_waiter'; bool get isNewOrder => type == 'guest_order_new'; bool get isOrderReady => type == 'guest_order_ready'; }