import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:krow/core/data/static/contacts_data.dart';
import 'package:krow/core/presentation/gen/assets.gen.dart';
import 'package:krow/core/presentation/styles/kw_box_decorations.dart';
import 'package:krow/core/presentation/styles/kw_text_styles.dart';
import 'package:krow/core/presentation/styles/theme.dart';
import 'package:krow/core/presentation/widgets/ui_kit/kw_app_bar.dart';
import 'package:krow/features/support/presentation/widget/contact_tile_widget.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:whatsapp_unilink/whatsapp_unilink.dart';

@RoutePage()
class SupportScreen extends StatelessWidget {
  const SupportScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned.fill(
          child: Container(
            color: AppColors.bgColorDark,
            child: SvgPicture.asset(
              Assets.images.bg.path,
              fit: BoxFit.cover,
            ),
          ),
        ),
        Scaffold(
          backgroundColor: Colors.transparent,
          appBar: KwAppBar(
            backgroundColor: Colors.transparent,
            iconColorStyle: AppBarIconColorStyle.inverted,
            showNotification: true,
            contentColor: AppColors.primaryYellow,
          ),
          body: SafeArea(
            top: false,
            child: Container(
              margin: const EdgeInsets.symmetric(
                horizontal: 16,
                vertical: 24,
              ),
              padding: const EdgeInsets.symmetric(
                horizontal: 12,
                vertical: 24,
              ),
              decoration: KwBoxDecorations.primaryDark,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                mainAxisSize: MainAxisSize.max,
                children: [
                  Expanded(
                    child: Assets.images.support.support.image(),
                  ),
                  const Gap(24),
                  Text(
                    'contact_support'.tr(),
                    textAlign: TextAlign.center,
                    style: AppTextStyles.headingH1.copyWith(
                      color: Colors.white,
                    ),
                  ),
                  const Gap(8),
                  Text(
                    'contact_support_desc'.tr(),
                    style: AppTextStyles.bodyMediumReg.copyWith(
                      color: AppColors.textPrimaryInverted,
                    ),
                    textAlign: TextAlign.center,
                  ),
                  const Gap(8),
                  Text(
                    'contact_support_desc_2'.tr(),
                    style: AppTextStyles.bodyMediumReg.copyWith(
                      color: AppColors.textPrimaryInverted,
                    ),
                    textAlign: TextAlign.center,
                  ),
                  const Gap(24),
                  ContactTileWidget(
                    icon: Assets.images.waitingValidation.sms,
                    label: 'for_general'.tr(),
                    contact: ContactsData.supportEmail,
                    onTap: () {
                      launchUrlString('mailto:${ContactsData.supportEmail}');
                    },
                  ),
                  const Gap(12),
                  ContactTileWidget(
                    icon: Assets.images.waitingValidation.call,
                    label: 'contact_phone:'.tr(),
                    contact: ContactsData.supportPhone,
                    onTap: () {
                      launchUrlString('tel:${ContactsData.supportPhone}');
                    },
                  ),
                  const Gap(12),
                  ContactTileWidget(
                    icon: Assets.images.waitingValidation.whatsapp,
                    label: 'WHATSAPP:',
                    contact: ContactsData.supportPhone,
                    onTap: () {
                      const link = WhatsAppUnilink(
                        phoneNumber: ContactsData.supportPhone,
                        text: 'Hello, ',
                      );
                      launchUrlString(link.toString());
                    },
                  ),
                ],
              ),
            ),
          ),
        ),
      ],
    );
  }
}
