import 'package:equatable/equatable.dart';

/// The workflow status of an [Invoice].
enum InvoiceStatus {
  /// Generated but not yet sent/finalized.
  open,

  /// Client has disputed a line item.
  disputed,

  /// Dispute has been handled.
  resolved,

  /// Invoice accepted by client.
  verified,

  /// Payment received.
  paid,

  /// Payment reconciled in accounting.
  reconciled,

  /// Payment not received by due date.
  overdue,
}

/// Represents a bill sent to a [Business] for services rendered.
class Invoice extends Equatable {

  const Invoice({
    required this.id,
    required this.eventId,
    required this.businessId,
    required this.status,
    required this.totalAmount,
    required this.workAmount,
    required this.addonsAmount,
    this.invoiceNumber,
    this.issueDate,
  });
  /// Unique identifier.
  final String id;

  /// The [Event] this invoice covers.
  final String eventId;

  /// The [Business] being billed.
  final String businessId;

  /// Current payment/approval status.
  final InvoiceStatus status;

  /// Grand total amount.
  final double totalAmount;

  /// Total amount for labor costs.
  final double workAmount;

  /// Total amount for addons/extras.
  final double addonsAmount;

  /// Human-readable invoice number.
  final String? invoiceNumber;

  /// Date when the invoice was issued.
  final DateTime? issueDate;

  @override
  List<Object?> get props => <Object?>[
        id,
        eventId,
        businessId,
        status,
        totalAmount,
        workAmount,
        addonsAmount,
        invoiceNumber,
        issueDate,
      ];
}
