import 'package:equatable/equatable.dart';

/// Represents a customer's view of an order or shift.
///
/// This entity captures the details necessary for the dashboard/view orders screen,
/// including status and worker assignments.
class OrderItem extends Equatable {
  /// Creates an [OrderItem].
  const OrderItem({
    required this.id,
    required this.orderId,
    required this.title,
    required this.clientName,
    required this.status,
    required this.date,
    required this.startTime,
    required this.endTime,
    required this.location,
    required this.locationAddress,
    required this.filled,
    required this.workersNeeded,
    required this.hourlyRate,
    this.hours = 0,
    this.totalValue = 0,
    this.confirmedApps = const <Map<String, dynamic>>[],
  });

  /// Unique identifier of the order.
  final String id;

  /// Parent order identifier.
  final String orderId;

  /// Title or name of the role.
  final String title;

  /// Name of the client company.
  final String clientName;

  /// status of the order (e.g., 'open', 'filled', 'completed').
  final String status;

  /// Date of the shift (ISO format).
  final String date;

  /// Start time of the shift.
  final String startTime;

  /// End time of the shift.
  final String endTime;

  /// Location name.
  final String location;

  /// Full address of the location.
  final String locationAddress;

  /// Number of workers currently filled.
  final int filled;

  /// Total number of workers required.
  final int workersNeeded;

  /// Hourly pay rate.
  final double hourlyRate;

  /// Total hours for the shift role.
  final double hours;

  /// Total value for the shift role.
  final double totalValue;

  /// List of confirmed worker applications.
  final List<Map<String, dynamic>> confirmedApps;

  @override
  List<Object?> get props => <Object?>[
    id,
    orderId,
    title,
    clientName,
    status,
    date,
    startTime,
    endTime,
    location,
    locationAddress,
    filled,
    workersNeeded,
    hourlyRate,
    hours,
    totalValue,
    confirmedApps,
  ];
}
