import 'package:em2rp/utils/permission_gate.dart';
import 'package:em2rp/views/widgets/data_management/event_statistics_tab.dart';
import 'package:em2rp/views/widgets/nav/custom_app_bar.dart';
import 'package:em2rp/views/widgets/nav/main_drawer.dart';
import 'package:flutter/material.dart';

class EventStatisticsPage extends StatelessWidget {
  const EventStatisticsPage({super.key});

  @override
  Widget build(BuildContext context) {
    return PermissionGate(
      requiredPermissions: const ['generate_reports'],
      fallback: const Scaffold(
        appBar: CustomAppBar(title: 'Acces refuse'),
        body: Center(
          child: Text(
            'Vous n\'avez pas les permissions necessaires pour acceder aux statistiques.',
            textAlign: TextAlign.center,
          ),
        ),
      ),
      child: const Scaffold(
        appBar: CustomAppBar(title: 'Statistiques evenements'),
        drawer: MainDrawer(currentPage: '/event_statistics'),
        body: EventStatisticsTab(),
      ),
    );
  }
}

