import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:minstrel/playlists/widgets/playlist_placeholder_card.dart';
import 'package:minstrel/theme/theme_data.dart';

void main() {
  testWidgets('building variant renders spinner + label', (tester) async {
    await tester.pumpWidget(MaterialApp(
      theme: buildThemeData(),
      home: const Scaffold(
        body: PlaylistPlaceholderCard(label: 'For You', variant: 'building'),
      ),
    ));
    expect(find.text('For You'), findsOneWidget);
    expect(find.text('Building…'), findsOneWidget);
    expect(find.byType(CircularProgressIndicator), findsOneWidget);
  });

  testWidgets('failed variant shows warning + copy', (tester) async {
    await tester.pumpWidget(MaterialApp(
      theme: buildThemeData(),
      home: const Scaffold(
        body: PlaylistPlaceholderCard(label: 'Songs like…', variant: 'failed'),
      ),
    ));
    expect(find.text("Couldn't generate"), findsOneWidget);
  });

  testWidgets('seed-needed variant copy', (tester) async {
    await tester.pumpWidget(MaterialApp(
      theme: buildThemeData(),
      home: const Scaffold(
        body: PlaylistPlaceholderCard(label: 'Songs like…', variant: 'seed-needed'),
      ),
    ));
    expect(find.text('Like more music'), findsOneWidget);
  });

  testWidgets('pending variant copy', (tester) async {
    await tester.pumpWidget(MaterialApp(
      theme: buildThemeData(),
      home: const Scaffold(
        body: PlaylistPlaceholderCard(label: 'For You', variant: 'pending'),
      ),
    ));
    expect(find.text('Coming soon'), findsOneWidget);
  });
}
