import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/service_report.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/status/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,
        ));
  }
}
