import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../../core/di/injection_container.dart';

/// 绑定邮箱页面
/// 支持绑定/更换邮箱，需要验证码验证
class BindEmailPage extends ConsumerStatefulWidget {
  const BindEmailPage({super.key});

  @override
  ConsumerState<BindEmailPage> createState() => _BindEmailPageState();
}

class _BindEmailPageState extends ConsumerState<BindEmailPage> {
  /// 邮箱控制器
  final TextEditingController _emailController = TextEditingController();

  /// 绑定验证码控制器
  final TextEditingController _codeController = TextEditingController();

  /// 解绑验证码控制器
  final TextEditingController _unbindCodeController = TextEditingController();

  /// 是否正在加载
  bool _isLoading = true;

  /// 是否已绑定邮箱
  bool _isBound = false;

  /// 当前绑定的邮箱（脱敏显示）
  String? _currentEmail;

  /// 是否正在发送绑定验证码
  bool _isSendingCode = false;

  /// 绑定验证码发送倒计时
  int _countdown = 0;

  /// 绑定倒计时定时器
  Timer? _countdownTimer;

  /// 是否正在发送解绑验证码
  bool _isSendingUnbindCode = false;

  /// 解绑验证码发送倒计时
  int _unbindCountdown = 0;

  /// 解绑倒计时定时器
  Timer? _unbindCountdownTimer;

  /// 是否正在提交
  bool _isSubmitting = false;

  @override
  void initState() {
    super.initState();
    _loadEmailStatus();
  }

  @override
  void dispose() {
    _emailController.dispose();
    _codeController.dispose();
    _unbindCodeController.dispose();
    _countdownTimer?.cancel();
    _unbindCountdownTimer?.cancel();
    super.dispose();
  }

  /// 加载邮箱状态
  Future<void> _loadEmailStatus() async {
    setState(() {
      _isLoading = true;
    });

    try {
      final accountService = ref.read(accountServiceProvider);
      final emailStatus = await accountService.getEmailStatus();

      if (mounted) {
        setState(() {
          _isBound = emailStatus.isBound;
          _currentEmail = emailStatus.email;
          _isLoading = false;
        });
      }
    } catch (e) {
      if (mounted) {
        setState(() {
          _isLoading = false;
        });
        _showErrorSnackBar('获取邮箱状态失败: ${e.toString().replaceAll('Exception: ', '')}');
      }
    }
  }

  /// 返回上一页
  void _goBack() {
    context.pop();
  }

  /// 验证邮箱格式
  bool _isValidEmail(String email) {
    return RegExp(r'^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$').hasMatch(email);
  }

  /// 发送验证码
  Future<void> _sendVerificationCode() async {
    final email = _emailController.text.trim();

    if (email.isEmpty) {
      _showErrorSnackBar('请输入邮箱地址');
      return;
    }

    if (!_isValidEmail(email)) {
      _showErrorSnackBar('请输入有效的邮箱地址');
      return;
    }

    setState(() {
      _isSendingCode = true;
    });

    try {
      final accountService = ref.read(accountServiceProvider);
      await accountService.sendEmailCode(
        email: email,
        purpose: 'BIND_EMAIL',
      );

      if (mounted) {
        setState(() {
          _isSendingCode = false;
          _countdown = 60;
        });

        // 启动倒计时
        _startCountdown();

        ScaffoldMessenger.of(context).showSnackBar(
          const SnackBar(
            content: Text('验证码已发送'),
            backgroundColor: Color(0xFFD4AF37),
          ),
        );
      }
    } catch (e) {
      if (mounted) {
        setState(() {
          _isSendingCode = false;
        });

        _showErrorSnackBar('发送失败: ${e.toString().replaceAll('Exception: ', '')}');
      }
    }
  }

  /// 启动倒计时
  void _startCountdown() {
    _countdownTimer?.cancel();
    _countdownTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
      if (_countdown > 0) {
        setState(() {
          _countdown--;
        });
      } else {
        timer.cancel();
      }
    });
  }

  /// 绑定邮箱
  Future<void> _bindEmail() async {
    final email = _emailController.text.trim();
    final code = _codeController.text.trim();

    if (email.isEmpty) {
      _showErrorSnackBar('请输入邮箱地址');
      return;
    }

    if (!_isValidEmail(email)) {
      _showErrorSnackBar('请输入有效的邮箱地址');
      return;
    }

    if (code.isEmpty) {
      _showErrorSnackBar('请输入验证码');
      return;
    }

    if (code.length != 6 || !RegExp(r'^\d{6}$').hasMatch(code)) {
      _showErrorSnackBar('验证码格式错误，请输入6位数字');
      return;
    }

    setState(() {
      _isSubmitting = true;
    });

    try {
      final accountService = ref.read(accountServiceProvider);
      await accountService.bindEmail(email: email, code: code);

      if (mounted) {
        setState(() {
          _isSubmitting = false;
        });

        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            content: Text(_isBound ? '邮箱更换成功' : '邮箱绑定成功'),
            backgroundColor: const Color(0xFF4CAF50),
          ),
        );

        context.pop(true);
      }
    } catch (e) {
      if (mounted) {
        setState(() {
          _isSubmitting = false;
        });

        _showErrorSnackBar('操作失败: ${e.toString().replaceAll('Exception: ', '')}');
      }
    }
  }

  /// 发送解绑验证码
  Future<void> _sendUnbindCode() async {
    if (_currentEmail == null || _currentEmail!.isEmpty) {
      _showErrorSnackBar('当前邮箱状态异常');
      return;
    }

    setState(() {
      _isSendingUnbindCode = true;
    });

    try {
      final accountService = ref.read(accountServiceProvider);
      await accountService.sendEmailCode(
        email: _currentEmail!,
        purpose: 'UNBIND_EMAIL',
      );

      if (mounted) {
        setState(() {
          _isSendingUnbindCode = false;
          _unbindCountdown = 60;
        });

        // 启动解绑倒计时
        _startUnbindCountdown();

        ScaffoldMessenger.of(context).showSnackBar(
          const SnackBar(
            content: Text('验证码已发送到您的邮箱'),
            backgroundColor: Color(0xFFD4AF37),
          ),
        );
      }
    } catch (e) {
      if (mounted) {
        setState(() {
          _isSendingUnbindCode = false;
        });

        _showErrorSnackBar('发送失败: ${e.toString().replaceAll('Exception: ', '')}');
      }
    }
  }

  /// 启动解绑倒计时
  void _startUnbindCountdown() {
    _unbindCountdownTimer?.cancel();
    _unbindCountdownTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
      if (_unbindCountdown > 0) {
        setState(() {
          _unbindCountdown--;
        });
      } else {
        timer.cancel();
      }
    });
  }

  /// 解绑邮箱
  Future<void> _unbindEmail() async {
    final code = _unbindCodeController.text.trim();

    if (code.isEmpty) {
      _showErrorSnackBar('请输入验证码');
      return;
    }

    if (code.length != 6 || !RegExp(r'^\d{6}$').hasMatch(code)) {
      _showErrorSnackBar('验证码格式错误，请输入6位数字');
      return;
    }

    // 显示确认对话框
    final confirmed = await showDialog<bool>(
      context: context,
      builder: (context) => AlertDialog(
        backgroundColor: Colors.white,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(16),
        ),
        title: const Text(
          '确认解绑',
          style: TextStyle(
            fontSize: 18,
            fontFamily: 'Inter',
            fontWeight: FontWeight.w600,
            color: Color(0xFF5D4037),
          ),
        ),
        content: const Text(
          '解绑后将无法通过该邮箱找回账户，确定要解绑吗？',
          style: TextStyle(
            fontSize: 14,
            fontFamily: 'Inter',
            color: Color(0xFF745D43),
          ),
        ),
        actions: [
          TextButton(
            onPressed: () => Navigator.pop(context, false),
            child: const Text(
              '取消',
              style: TextStyle(
                color: Color(0xFF8B5A2B),
              ),
            ),
          ),
          TextButton(
            onPressed: () => Navigator.pop(context, true),
            child: const Text(
              '确认解绑',
              style: TextStyle(
                color: Colors.red,
              ),
            ),
          ),
        ],
      ),
    );

    if (confirmed != true) return;

    setState(() {
      _isSubmitting = true;
    });

    try {
      final accountService = ref.read(accountServiceProvider);
      await accountService.unbindEmail(code: code);

      if (mounted) {
        setState(() {
          _isBound = false;
          _currentEmail = null;
          _isSubmitting = false;
        });

        ScaffoldMessenger.of(context).showSnackBar(
          const SnackBar(
            content: Text('邮箱已解绑'),
            backgroundColor: Color(0xFFD4AF37),
          ),
        );

        // 清空输入
        _emailController.clear();
        _codeController.clear();
        _unbindCodeController.clear();
      }
    } catch (e) {
      if (mounted) {
        setState(() {
          _isSubmitting = false;
        });

        _showErrorSnackBar('解绑失败: ${e.toString().replaceAll('Exception: ', '')}');
      }
    }
  }

  /// 显示错误提示
  void _showErrorSnackBar(String message) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text(message),
        backgroundColor: Colors.red,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Container(
        width: double.infinity,
        height: double.infinity,
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
            colors: [
              Color(0xFFFFF5E6),
              Color(0xFFFFE4B5),
            ],
          ),
        ),
        child: SafeArea(
          child: Column(
            children: [
              // 顶部导航栏
              _buildAppBar(),
              // 内容区域
              Expanded(
                child: _isLoading
                    ? const Center(
                        child: CircularProgressIndicator(
                          valueColor: AlwaysStoppedAnimation<Color>(Color(0xFFD4AF37)),
                        ),
                      )
                    : SingleChildScrollView(
                        padding: const EdgeInsets.all(16),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            // 状态卡片
                            _buildStatusCard(),
                            const SizedBox(height: 24),

                            // 邮箱输入
                            _buildEmailInput(),
                            const SizedBox(height: 16),

                            // 验证码输入
                            _buildCodeInput(),
                            const SizedBox(height: 8),

                            // 提示信息
                            _buildHintText(),
                            const SizedBox(height: 32),

                            // 提交按钮
                            _buildSubmitButton(),

                            // 解绑区域（已绑定时显示）
                            if (_isBound) ...[
                              const SizedBox(height: 24),
                              _buildUnbindSection(),
                            ],
                          ],
                        ),
                      ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  /// 构建顶部导航栏
  Widget _buildAppBar() {
    return Container(
      height: 64,
      padding: const EdgeInsets.only(top: 16, left: 16, right: 16),
      child: Row(
        children: [
          // 返回按钮
          GestureDetector(
            onTap: _goBack,
            child: Container(
              width: 48,
              height: 48,
              alignment: Alignment.center,
              child: const Icon(
                Icons.arrow_back,
                size: 24,
                color: Color(0xFF5D4037),
              ),
            ),
          ),
          // 标题
          Expanded(
            child: Text(
              _isBound ? '更换邮箱' : '绑定邮箱',
              style: const TextStyle(
                fontSize: 18,
                fontFamily: 'Inter',
                fontWeight: FontWeight.w500,
                height: 1.25,
                letterSpacing: -0.27,
                color: Color(0xFF5D4037),
              ),
              textAlign: TextAlign.center,
            ),
          ),
          // 占位
          const SizedBox(width: 48),
        ],
      ),
    );
  }

  /// 构建状态卡片
  Widget _buildStatusCard() {
    return Container(
      width: double.infinity,
      padding: const EdgeInsets.all(16),
      decoration: BoxDecoration(
        color: const Color(0x80FFFFFF),
        borderRadius: BorderRadius.circular(12),
        border: Border.all(
          color: const Color(0x33D4AF37),
          width: 1,
        ),
      ),
      child: Row(
        children: [
          Container(
            width: 48,
            height: 48,
            decoration: BoxDecoration(
              color: _isBound
                  ? const Color(0xFF4CAF50).withValues(alpha: 0.1)
                  : const Color(0xFFFF9800).withValues(alpha: 0.1),
              borderRadius: BorderRadius.circular(24),
            ),
            child: Icon(
              _isBound ? Icons.email : Icons.email_outlined,
              color: _isBound ? const Color(0xFF4CAF50) : const Color(0xFFFF9800),
              size: 24,
            ),
          ),
          const SizedBox(width: 16),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  _isBound ? '已绑定' : '未绑定',
                  style: TextStyle(
                    fontSize: 18,
                    fontFamily: 'Inter',
                    fontWeight: FontWeight.w600,
                    color: _isBound ? const Color(0xFF4CAF50) : const Color(0xFFFF9800),
                  ),
                ),
                const SizedBox(height: 4),
                Text(
                  _isBound
                      ? '当前邮箱: $_currentEmail'
                      : '绑定邮箱后可用于账户安全验证',
                  style: const TextStyle(
                    fontSize: 14,
                    fontFamily: 'Inter',
                    color: Color(0xFF745D43),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

  /// 构建邮箱输入框
  Widget _buildEmailInput() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          _isBound ? '新邮箱地址' : '邮箱地址',
          style: const TextStyle(
            fontSize: 16,
            fontFamily: 'Inter',
            fontWeight: FontWeight.w500,
            color: Color(0xFF5D4037),
          ),
        ),
        const SizedBox(height: 8),
        Container(
          width: double.infinity,
          height: 54,
          decoration: BoxDecoration(
            color: const Color(0x80FFFFFF),
            borderRadius: BorderRadius.circular(12),
            border: Border.all(
              color: const Color(0x80FFFFFF),
              width: 1,
            ),
            boxShadow: const [
              BoxShadow(
                color: Color(0x0D000000),
                blurRadius: 2,
                offset: Offset(0, 1),
              ),
            ],
          ),
          child: TextField(
            controller: _emailController,
            keyboardType: TextInputType.emailAddress,
            style: const TextStyle(
              fontSize: 16,
              fontFamily: 'Inter',
              height: 1.19,
              color: Color(0xFF5D4037),
            ),
            decoration: const InputDecoration(
              contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 15),
              border: InputBorder.none,
              hintText: '请输入邮箱地址',
              hintStyle: TextStyle(
                fontSize: 16,
                fontFamily: 'Inter',
                height: 1.19,
                color: Color(0x995D4037),
              ),
              prefixIcon: Icon(
                Icons.email_outlined,
                color: Color(0xFF8B5A2B),
                size: 20,
              ),
            ),
          ),
        ),
      ],
    );
  }

  /// 构建验证码输入框
  Widget _buildCodeInput() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        const Text(
          '验证码',
          style: TextStyle(
            fontSize: 16,
            fontFamily: 'Inter',
            fontWeight: FontWeight.w500,
            color: Color(0xFF5D4037),
          ),
        ),
        const SizedBox(height: 8),
        Row(
          children: [
            // 验证码输入框
            Expanded(
              child: Container(
                height: 54,
                decoration: BoxDecoration(
                  color: const Color(0x80FFFFFF),
                  borderRadius: BorderRadius.circular(12),
                  border: Border.all(
                    color: const Color(0x80FFFFFF),
                    width: 1,
                  ),
                  boxShadow: const [
                    BoxShadow(
                      color: Color(0x0D000000),
                      blurRadius: 2,
                      offset: Offset(0, 1),
                    ),
                  ],
                ),
                child: TextField(
                  controller: _codeController,
                  keyboardType: TextInputType.number,
                  maxLength: 6,
                  style: const TextStyle(
                    fontSize: 16,
                    fontFamily: 'Inter',
                    height: 1.19,
                    color: Color(0xFF5D4037),
                  ),
                  decoration: const InputDecoration(
                    counterText: '',
                    contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 15),
                    border: InputBorder.none,
                    hintText: '请输入验证码',
                    hintStyle: TextStyle(
                      fontSize: 16,
                      fontFamily: 'Inter',
                      height: 1.19,
                      color: Color(0x995D4037),
                    ),
                  ),
                ),
              ),
            ),
            const SizedBox(width: 12),
            // 发送验证码按钮
            GestureDetector(
              onTap: (_countdown > 0 || _isSendingCode) ? null : _sendVerificationCode,
              child: Container(
                height: 54,
                padding: const EdgeInsets.symmetric(horizontal: 16),
                decoration: BoxDecoration(
                  color: (_countdown > 0 || _isSendingCode)
                      ? const Color(0xFFD4AF37).withValues(alpha: 0.5)
                      : const Color(0xFFD4AF37),
                  borderRadius: BorderRadius.circular(12),
                ),
                child: Center(
                  child: _isSendingCode
                      ? const SizedBox(
                          width: 20,
                          height: 20,
                          child: CircularProgressIndicator(
                            strokeWidth: 2,
                            valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
                          ),
                        )
                      : Text(
                          _countdown > 0 ? '${_countdown}s' : '获取验证码',
                          style: const TextStyle(
                            fontSize: 14,
                            fontFamily: 'Inter',
                            fontWeight: FontWeight.w600,
                            color: Colors.white,
                          ),
                        ),
                ),
              ),
            ),
          ],
        ),
      ],
    );
  }

  /// 构建提示文字
  Widget _buildHintText() {
    return Container(
      width: double.infinity,
      padding: const EdgeInsets.all(12),
      decoration: BoxDecoration(
        color: const Color(0xFFFFF5E6),
        borderRadius: BorderRadius.circular(8),
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: const [
          Icon(
            Icons.info_outline,
            size: 16,
            color: Color(0xFF8B5A2B),
          ),
          SizedBox(width: 8),
          Expanded(
            child: Text(
              '验证码将发送到您输入的邮箱，请注意查收。如未收到，请检查垃圾邮件。',
              style: TextStyle(
                fontSize: 12,
                fontFamily: 'Inter',
                color: Color(0xFF745D43),
              ),
            ),
          ),
        ],
      ),
    );
  }

  /// 构建提交按钮
  Widget _buildSubmitButton() {
    return GestureDetector(
      onTap: _isSubmitting ? null : _bindEmail,
      child: Container(
        width: double.infinity,
        height: 56,
        decoration: BoxDecoration(
          color: _isSubmitting
              ? const Color(0xFFD4AF37).withValues(alpha: 0.5)
              : const Color(0xFFD4AF37),
          borderRadius: BorderRadius.circular(12),
          boxShadow: const [
            BoxShadow(
              color: Color(0x4DD4AF37),
              blurRadius: 14,
              offset: Offset(0, 4),
            ),
          ],
        ),
        child: Center(
          child: _isSubmitting
              ? const SizedBox(
                  width: 24,
                  height: 24,
                  child: CircularProgressIndicator(
                    strokeWidth: 2,
                    valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
                  ),
                )
              : Text(
                  _isBound ? '更换邮箱' : '绑定邮箱',
                  style: const TextStyle(
                    fontSize: 16,
                    fontFamily: 'Inter',
                    fontWeight: FontWeight.w700,
                    height: 1.5,
                    letterSpacing: 0.24,
                    color: Colors.white,
                  ),
                ),
        ),
      ),
    );
  }

  /// 构建解绑区域
  Widget _buildUnbindSection() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        // 分隔线
        Container(
          width: double.infinity,
          height: 1,
          color: const Color(0x33D4AF37),
        ),
        const SizedBox(height: 24),

        // 解绑标题
        const Text(
          '解绑邮箱',
          style: TextStyle(
            fontSize: 16,
            fontFamily: 'Inter',
            fontWeight: FontWeight.w500,
            color: Colors.red,
          ),
        ),
        const SizedBox(height: 8),
        Text(
          '解绑验证码将发送到当前绑定的邮箱: $_currentEmail',
          style: const TextStyle(
            fontSize: 12,
            fontFamily: 'Inter',
            color: Color(0xFF745D43),
          ),
        ),
        const SizedBox(height: 16),

        // 解绑验证码输入
        Row(
          children: [
            // 验证码输入框
            Expanded(
              child: Container(
                height: 54,
                decoration: BoxDecoration(
                  color: const Color(0x80FFFFFF),
                  borderRadius: BorderRadius.circular(12),
                  border: Border.all(
                    color: const Color(0x80FFFFFF),
                    width: 1,
                  ),
                  boxShadow: const [
                    BoxShadow(
                      color: Color(0x0D000000),
                      blurRadius: 2,
                      offset: Offset(0, 1),
                    ),
                  ],
                ),
                child: TextField(
                  controller: _unbindCodeController,
                  keyboardType: TextInputType.number,
                  maxLength: 6,
                  style: const TextStyle(
                    fontSize: 16,
                    fontFamily: 'Inter',
                    height: 1.19,
                    color: Color(0xFF5D4037),
                  ),
                  decoration: const InputDecoration(
                    counterText: '',
                    contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 15),
                    border: InputBorder.none,
                    hintText: '请输入解绑验证码',
                    hintStyle: TextStyle(
                      fontSize: 16,
                      fontFamily: 'Inter',
                      height: 1.19,
                      color: Color(0x995D4037),
                    ),
                  ),
                ),
              ),
            ),
            const SizedBox(width: 12),
            // 发送解绑验证码按钮
            GestureDetector(
              onTap: (_unbindCountdown > 0 || _isSendingUnbindCode) ? null : _sendUnbindCode,
              child: Container(
                height: 54,
                padding: const EdgeInsets.symmetric(horizontal: 16),
                decoration: BoxDecoration(
                  color: (_unbindCountdown > 0 || _isSendingUnbindCode)
                      ? Colors.red.withValues(alpha: 0.3)
                      : Colors.red.withValues(alpha: 0.8),
                  borderRadius: BorderRadius.circular(12),
                ),
                child: Center(
                  child: _isSendingUnbindCode
                      ? const SizedBox(
                          width: 20,
                          height: 20,
                          child: CircularProgressIndicator(
                            strokeWidth: 2,
                            valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
                          ),
                        )
                      : Text(
                          _unbindCountdown > 0 ? '${_unbindCountdown}s' : '发送验证码',
                          style: const TextStyle(
                            fontSize: 14,
                            fontFamily: 'Inter',
                            fontWeight: FontWeight.w600,
                            color: Colors.white,
                          ),
                        ),
                ),
              ),
            ),
          ],
        ),
        const SizedBox(height: 16),

        // 解绑按钮
        GestureDetector(
          onTap: _isSubmitting ? null : _unbindEmail,
          child: Container(
            width: double.infinity,
            height: 56,
            decoration: BoxDecoration(
              color: Colors.transparent,
              borderRadius: BorderRadius.circular(12),
              border: Border.all(
                color: Colors.red.withValues(alpha: 0.5),
                width: 1,
              ),
            ),
            child: Center(
              child: _isSubmitting
                  ? const SizedBox(
                      width: 24,
                      height: 24,
                      child: CircularProgressIndicator(
                        strokeWidth: 2,
                        valueColor: AlwaysStoppedAnimation<Color>(Colors.red),
                      ),
                    )
                  : const Text(
                      '确认解绑',
                      style: TextStyle(
                        fontSize: 16,
                        fontFamily: 'Inter',
                        fontWeight: FontWeight.w600,
                        height: 1.5,
                        color: Colors.red,
                      ),
                    ),
            ),
          ),
        ),
      ],
    );
  }
}
