part of 'sales_analysis_bloc.dart';

enum KpiStatus { initial, loading, success, failure }
enum CommentStatus { initial, loading, success, failure }

abstract class SalesAnalysisState {
  const SalesAnalysisState();
}

class SalesAnalysisInitial extends SalesAnalysisState {}

class SalesAnalysisLoading extends SalesAnalysisState {}

class SalesAnalysisLoaded extends SalesAnalysisState {
  final Map<String, dynamic> salesData;
  final SalesStatsEntity? salesStats;
  final KpiStatus kpiStatus;
  final String? kpiErrorMessage;
  final List<CommentEntity> comments;
  final CommentStatus commentStatus;
  final String? commentErrorMessage;

  const SalesAnalysisLoaded({
    required this.salesData,
    this.salesStats,
    this.kpiStatus = KpiStatus.initial,
    this.kpiErrorMessage,
    this.comments = const [],
    this.commentStatus = CommentStatus.initial,
    this.commentErrorMessage,
  });

  SalesAnalysisLoaded copyWith({
    Map<String, dynamic>? salesData,
    SalesStatsEntity? salesStats,
    KpiStatus? kpiStatus,
    String? kpiErrorMessage,
    List<CommentEntity>? comments,
    CommentStatus? commentStatus,
    String? commentErrorMessage,
  }) {
    return SalesAnalysisLoaded(
      salesData: salesData ?? this.salesData,
      salesStats: salesStats ?? this.salesStats,
      kpiStatus: kpiStatus ?? this.kpiStatus,
      kpiErrorMessage: kpiErrorMessage ?? this.kpiErrorMessage,
      comments: comments ?? this.comments,
      commentStatus: commentStatus ?? this.commentStatus,
      commentErrorMessage: commentErrorMessage ?? this.commentErrorMessage,
    );
  }
}

class SalesAnalysisError extends SalesAnalysisState {
  final String message;
  const SalesAnalysisError(this.message);
}