import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/l10n/l10n.dart';
import 'admin_ai_panel.dart';
import 'admin_aliases_panel.dart';
import 'admin_database_panel.dart';
import 'admin_pending_products_panel.dart';
import 'admin_products_panel.dart';
import 'admin_users_panel.dart';

class AdminScreen extends ConsumerStatefulWidget {
  const AdminScreen({super.key});

  @override
  ConsumerState<AdminScreen> createState() => _AdminScreenState();
}

class _AdminScreenState extends ConsumerState<AdminScreen> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 6,
      child: Column(
        children: [
          Material(
            color: Theme.of(context).colorScheme.surface,
            child: TabBar(
              isScrollable: true,
              tabs: [
                Tab(text: context.l10n.profileUsersTab, icon: const Icon(Icons.people_outline)),
                const Tab(text: 'Databas', icon: Icon(Icons.storage_outlined)),
                const Tab(text: 'Produkter', icon: Icon(Icons.inventory_2_outlined)),
                Tab(text: context.l10n.profilePendingTab, icon: const Icon(Icons.pending_actions_outlined)),
                const Tab(text: 'Alias', icon: Icon(Icons.link_outlined)),
                const Tab(text: 'AI', icon: Icon(Icons.auto_awesome_outlined)),
              ],
            ),
          ),
          const Expanded(
            child: TabBarView(
              children: [
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminUsersPanel(embedded: true),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminDatabasePanel(embedded: true),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminProductsPanel(embedded: true),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminPendingProductsPanel(embedded: true),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminAliasesPanel(embedded: true),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
                  child: AdminAiPanel(embedded: true),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

