import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../../../application/auth/logout_form/logout_form_bloc.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import 'profile_tile.dart';

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

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: AppValue.margin),
      decoration: BoxDecoration(
        color: AppColor.surface,
        borderRadius: BorderRadius.circular(12),
        border: Border.all(color: AppColor.error.withOpacity(0.3)),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.05),
            blurRadius: 10,
            offset: const Offset(0, 2),
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          ProfileTile(
            icon: Icons.logout,
            title: context.lang.logout,
            subtitle: context.lang.logout_desc,
            iconColor: AppColor.error,
            textColor: AppColor.error,
            onTap: () {
              context.read<LogoutFormBloc>().add(LogoutFormEvent.submitted());
            },
          ),
        ],
      ),
    );
  }
}
