import 'package:comwell_key_app/presentation/screens/booking_details/bloc/booking_details_cubit.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';

class PreregisterButton extends StatelessWidget {
  const PreregisterButton({super.key});

  @override
  Widget build(BuildContext context) {
    final cubit = context.read<BookingDetailsCubit>();
    final theme = Theme.of(context);

    

    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 8),
      child: ElevatedButton(
        onPressed: () async {
          final (result) = await context.push(
              AppRoutes.preregistration,
              extra: [cubit.booking, cubit.state.upSales]);
          if (result != null) {
            cubit.preregisterEvent();
          }
        },
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 8),
          child: Row(
            children: [
              SvgPicture.asset("assets/icons/ic_exit.svg"),
              const SizedBox(width: 16),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    context.strings.prepare_room,
                    style: theme.textTheme.titleMedium?.copyWith(
                        color: colorBackground, fontWeight: FontWeight.w600),
                  ),
                  Text(
                    context.strings.jump_line_text,
                    style: theme.textTheme.bodySmall
                        ?.copyWith(color: colorBackground),
                  ),
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}