import 'package:equatable/equatable.dart';
import 'one_time_order_position.dart';

/// Represents a customer's request for a single event or shift.
///
/// Encapsulates the date, primary location, and a list of specific [OneTimeOrderPosition] requirements.
class OneTimeOrder extends Equatable {

  const OneTimeOrder({
    required this.date,
    required this.location,
    required this.positions,
    this.hub,
    this.eventName,
    this.vendorId,
    this.roleRates = const <String, double>{},
  });
  /// The specific date for the shift or event.
  final DateTime date;

  /// The primary location where the work will take place.
  final String location;

  /// The list of positions and headcounts required for this order.
  final List<OneTimeOrderPosition> positions;

  /// Selected hub details for this order.
  final OneTimeOrderHubDetails? hub;

  /// Optional order name.
  final String? eventName;

  /// Selected vendor id for this order.
  final String? vendorId;

  /// Role hourly rates keyed by role id.
  final Map<String, double> roleRates;

  @override
  List<Object?> get props => <Object?>[
    date,
    location,
    positions,
    hub,
    eventName,
    vendorId,
    roleRates,
  ];
}

/// Minimal hub details used during order creation.
class OneTimeOrderHubDetails extends Equatable {
  const OneTimeOrderHubDetails({
    required this.id,
    required this.name,
    required this.address,
    this.placeId,
    this.latitude,
    this.longitude,
    this.city,
    this.state,
    this.street,
    this.country,
    this.zipCode,
  });

  final String id;
  final String name;
  final String address;
  final String? placeId;
  final double? latitude;
  final double? longitude;
  final String? city;
  final String? state;
  final String? street;
  final String? country;
  final String? zipCode;

  @override
  List<Object?> get props => <Object?>[
    id,
    name,
    address,
    placeId,
    latitude,
    longitude,
    city,
    state,
    street,
    country,
    zipCode,
  ];
}
