import 'package:equatable/equatable.dart'; enum OrderType { buy, sell } enum OrderStatus { pending, partial, filled, cancelled } class TradeOrder extends Equatable { final String id; final String accountSequence; final OrderType orderType; final OrderStatus status; final String price; final String quantity; final String filledQuantity; final String totalAmount; final DateTime createdAt; final DateTime? updatedAt; const TradeOrder({ required this.id, required this.accountSequence, required this.orderType, required this.status, required this.price, required this.quantity, required this.filledQuantity, required this.totalAmount, required this.createdAt, this.updatedAt, }); bool get isBuy => orderType == OrderType.buy; bool get isSell => orderType == OrderType.sell; bool get isPending => status == OrderStatus.pending; bool get isFilled => status == OrderStatus.filled; String get remainingQuantity { final qty = double.tryParse(quantity) ?? 0; final filled = double.tryParse(filledQuantity) ?? 0; return (qty - filled).toString(); } @override List get props => [id, accountSequence, orderType, status, price, quantity]; }