import 'package:equatable/equatable.dart';

/// Status of a time card.
enum TimeCardStatus {
  /// Waiting for approval or payment.
  pending,
  /// Approved by manager.
  approved,
  /// Payment has been issued.
  paid,
  /// Disputed by staff or client.
  disputed;

  /// Whether the card is approved.
  bool get isApproved => this == TimeCardStatus.approved;
  /// Whether the card is paid.
  bool get isPaid => this == TimeCardStatus.paid;
  /// Whether the card is disputed.
  bool get isDisputed => this == TimeCardStatus.disputed;
  /// Whether the card is pending.
  bool get isPending => this == TimeCardStatus.pending;
}

/// Represents a time card for a staff member.
class TimeCard extends Equatable {
  /// Unique identifier of the time card (often matches Application ID).
  final String id;
  /// Title of the shift.
  final String shiftTitle;
  /// Name of the client business.
  final String clientName;
  /// Date of the shift.
  final DateTime date;
  /// Actual or scheduled start time.
  final String startTime;
  /// Actual or scheduled end time.
  final String endTime;
  /// Total hours worked.
  final double totalHours;
  /// Hourly pay rate.
  final double hourlyRate;
  /// Total pay amount.
  final double totalPay;
  /// Current status of the time card.
  final TimeCardStatus status;
  /// Location name.
  final String? location;

  /// Creates a [TimeCard].
  const TimeCard({
    required this.id,
    required this.shiftTitle,
    required this.clientName,
    required this.date,
    required this.startTime,
    required this.endTime,
    required this.totalHours,
    required this.hourlyRate,
    required this.totalPay,
    required this.status,
    this.location,
  });

  @override
  List<Object?> get props => [
        id,
        shiftTitle,
        clientName,
        date,
        startTime,
        endTime,
        totalHours,
        hourlyRate,
        totalPay,
        status,
        location,
      ];
}
