import 'package:bloc/bloc.dart';
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
import 'package:enaklo_pos/data/models/response/print_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'get_printer_ticket_event.dart';
part 'get_printer_ticket_state.dart';
part 'get_printer_ticket_bloc.freezed.dart';

class GetPrinterTicketBloc
    extends Bloc<GetPrinterTicketEvent, GetPrinterTicketState> {
  GetPrinterTicketBloc() : super(_Initial()) {
    on<_Get>((event, emit) async {
      emit(_Loading());
      final result =
          await PrinterLocalDatasource.instance.getPrinterByCode('ticket');
      emit(_Success(result));
    });
  }
}
