class EarningShiftEntity {
  final String id;
  final EarningStatus status;
  final String businessImageUrl;
  final String skillName;
  final String businessName;
  final int? totalBreakTime;
  final int? paymentStatus;
  final double? earned;
  final DateTime? clockIn;
  final DateTime? clockOut;
  final String eventName;
  final DateTime eventDate;

  EarningShiftEntity({
    required this.id,
    required this.status,
    required this.businessImageUrl,
    required this.skillName,
    required this.businessName,
    required this.totalBreakTime,
    required this.paymentStatus,
    required this.earned,
    required this.clockIn,
    required this.clockOut,
    required this.eventName,
    required this.eventDate,
  });

  int get paymentProgressStep {
    return switch (status) {
      EarningStatus.pending => 0, // corresponds to Pending Sent
      EarningStatus.processing => 1, // corresponds to Pending Payment
      EarningStatus.paid => 2, // corresponds to Payment Received
      _ => -1, // don't show active step
    };
  }
}

enum EarningStatus {
  new_,
  pending,
  confirmedByAdmin,
  confirmedByStaff,
  declineByStaff,
  processing,
  paid,
  failed,
  canceled;

  static EarningStatus fromString(value) {
    return switch (value) {
      'new' => new_,
      'confirmed_by_admin' => confirmedByAdmin,
      'confirmed_by_staff' => confirmedByStaff,
      'decline_by_staff' => declineByStaff,
      'pending' => pending,
      'paid' => paid,
      'failed' => failed,
      'canceled' => canceled,
      _ => canceled,
    };
  }
}
