import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.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 '../../common/components/shimmer_loader/spa_facility_shimmer_loader.dart';

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

  @override
  Widget build(BuildContext context) {
    final cubit = context.read<HotelInformationCubit>();
    final isLoading = cubit.state.spaButtonIsLoading;
    return Scaffold(
      bottomSheet: Builder(
        builder: (context) {
          return Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              const Divider(
                color: colorDivider,
                height: 0,
              ),
              Row(
                children: [
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.all(16.0),
                      child: ElevatedButton(
                        onPressed: isLoading ? null : cubit.onBookSpaClicked,
                        style: ButtonStyle(
                          backgroundColor: WidgetStateProperty.resolveWith((states) {
                            if (states.contains(WidgetState.disabled)) {
                              return Colors.grey;
                            }
                            return sandColor[80];
                          }),
                          foregroundColor: const WidgetStatePropertyAll(Colors.white),
                        ),
                        child: Padding(
                          padding: const EdgeInsets.symmetric(vertical: 16.0),
                          child: Builder(
                            builder: (context) {
                              if (isLoading) {
                                return const SpaFacilityShimmerLoader();
                              }
                              return Text(
                                "${context.strings.hotel_information_page_spa_button} Spa ${cubit.state.spaButtonIsLoading}",
                              );
                            },
                          ),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ],
          );
        },
      ),
      body: const Center(
        child: Column(
          children: [Text("Spa")],
        ),
      ),
    );
  }
}