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

abstract class PaymentsState extends Equatable {
  const PaymentsState();

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

class PaymentsInitial extends PaymentsState {}

class PaymentsLoading extends PaymentsState {}

class PaymentsLoaded extends PaymentsState {

  const PaymentsLoaded({
    required this.summary,
    required this.history,
    this.activePeriod = 'week',
  });
  final PaymentSummary summary;
  final List<StaffPayment> history;
  final String activePeriod;

  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 => <Object?>[summary, history, activePeriod];
}

class PaymentsError extends PaymentsState {

  const PaymentsError(this.message);
  final String message;

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