import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_modular/flutter_modular.dart';
import '../blocs/client_create_order_bloc.dart';
import '../blocs/client_create_order_event.dart';
import '../widgets/create_order/create_order_view.dart';

/// Main entry page for the client create order flow.
///
/// This page initializes the [ClientCreateOrderBloc] and displays the [CreateOrderView].
/// It follows the Krow Clean Architecture by being a [StatelessWidget] and
/// delegating its state and UI to other components.
class ClientCreateOrderPage extends StatelessWidget {
  /// Creates a [ClientCreateOrderPage].
  const ClientCreateOrderPage({super.key});

  @override
  Widget build(BuildContext context) {
    return BlocProvider<ClientCreateOrderBloc>(
      create: (BuildContext context) =>
          Modular.get<ClientCreateOrderBloc>()
            ..add(const ClientCreateOrderTypesRequested()),
      child: const CreateOrderView(),
    );
  }
}
