import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/domain/repositories/counter_repository.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/domain/usecases/counter/decrement_counter.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/domain/usecases/counter/increment_counter.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/presentation/features/counter/blocs/counter_cubit.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/presentation/features/counter/state_management/counter_text_consumer.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/presentation/features/counter/widgets/counter_base.dart';

class CounterPageProvider extends CubitProviderScreen<CounterCubit, int> {
  const CounterPageProvider({super.key});

  @override
  CounterCubit create(BuildContext context) => CounterCubit(
        decrementCounter: DecrementCounter(
          counterRepository: repo<CounterRepository>(context),
        ),
        incrementCounter: IncrementCounter(
          counterRepository: repo<CounterRepository>(context),
        ),
      );

  @override
  Widget builder(BuildContext context) => CounterBase(
        fabIncrement: () => bloc(context).increment(),
        fabIncrementBy10: () => bloc(context).increment(by: 10),
        fabDecrement: () => bloc(context).decrement(),
        fabDecrementBy10: () => bloc(context).decrement(by: 10),
        child: const CounterTextConsumer(),
      );
}
