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

import '../../../../controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart';
import '../../../../models/lookup.dart';
import '../../../../models/service_report.dart';
import '../../loaders/loading_manager.dart';
import '../single_status_menu.dart';

class ServiceReportLastCallsMenu extends StatelessWidget {
  final Function(Lookup?)? onSelect;
  final ServiceReport? report;

  const ServiceReportLastCallsMenu({
    Key? key,
    required this.onSelect,
    required this.report,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ServiceReportLastCallsProvider menuProvider = Provider.of<ServiceReportLastCallsProvider>(context);
    return LoadingManager(
      isLoading: menuProvider.isLoading,
      isFailedLoading: menuProvider.calls == null,
      stateCode: menuProvider.stateCode,
      onRefresh: () async {},
      child: SingleStatusMenu(
        initialStatus: report?.callLastSituation,
        statuses: menuProvider.calls,
        onSelect: onSelect,
      ),
    );
  }
}
