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

abstract class PaymentsState extends Equatable {
  const PaymentsState();

  @override
  List<Object?> get props => [];
}

class PaymentsInitial extends PaymentsState {}

class PaymentsLoading extends PaymentsState {}

class PaymentsLoaded extends PaymentsState {
  final PaymentSummary summary;
  final List<StaffPayment> history;
  final String activePeriod;

  const PaymentsLoaded({
    required this.summary,
    required this.history,
    this.activePeriod = 'week',
  });

  PaymentsLoaded copyWith({
    PaymentSummary? summary,
    List<StaffPayment>? history,
    String? activePeriod,
  }) {
    return PaymentsLoaded(
      summary: summary ?? this.summary,
      history: history ?? this.history,
      activePeriod: activePeriod ?? this.activePeriod,
    );
  }

  @override
  List<Object?> get props => [summary, history, activePeriod];
}

class PaymentsError extends PaymentsState {
  final String message;

  const PaymentsError(this.message);

  @override
  List<Object?> get props => [message];
}
