/// Tests unitaires pour SubmitEventFeedback use case
library submit_event_feedback_test;

import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:unionflow_mobile_apps/features/events/domain/repositories/evenement_repository.dart';
import 'package:unionflow_mobile_apps/features/events/domain/usecases/submit_event_feedback.dart';

@GenerateMocks([IEvenementRepository])
import 'submit_event_feedback_test.mocks.dart';

void main() {
  late SubmitEventFeedback useCase;
  late MockIEvenementRepository mockRepository;

  setUp(() {
    mockRepository = MockIEvenementRepository();
    useCase = SubmitEventFeedback(mockRepository);
  });

  group('SubmitEventFeedback Use Case', () {
    const tEventId = 'event123';
    const tNote = 5;
    const tCommentaire = 'Excellent événement, très enrichissant!';

    test('should throw UnimplementedError as endpoint not available', () async {
      // Act & Assert
      expect(
        () => useCase(evenementId: tEventId, note: tNote),
        throwsA(isA<UnimplementedError>()),
      );
    });

    test('should throw UnimplementedError with feedback message', () async {
      // Act & Assert
      expect(
        () => useCase(
          evenementId: tEventId,
          note: tNote,
          commentaire: tCommentaire,
        ),
        throwsA(isA<UnimplementedError>()),
      );
    });

    test('should throw UnimplementedError for minimum rating', () async {
      // Act & Assert
      expect(
        () => useCase(evenementId: tEventId, note: 1),
        throwsA(isA<UnimplementedError>()),
      );
    });

    test('should throw UnimplementedError for maximum rating', () async {
      // Act & Assert
      expect(
        () => useCase(
          evenementId: tEventId,
          note: 5,
          commentaire: 'Parfait!',
        ),
        throwsA(isA<UnimplementedError>()),
      );
    });
  });
}
