import 'package:autosos_flutter/util/toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

/// 微信绑定页（对应 Android BindWxActivity）
class BindWxPage extends ConsumerWidget {
  const BindWxPage({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Scaffold(
      appBar: AppBar(title: const Text('绑定微信')),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(24),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              const Icon(Icons.wechat, size: 96, color: Colors.green),
              const SizedBox(height: 24),
              const Text(
                '点击下方按钮通过微信授权绑定',
                style: TextStyle(fontSize: 14, color: Colors.grey),
                textAlign: TextAlign.center,
              ),
              const SizedBox(height: 32),
              ElevatedButton.icon(
                onPressed: () async {
                  // TODO: 调用 fluwx 发起微信授权
                  // final result = await fluwx.authByWx();
                  // final wxCode = result.code;
                  // ... 调后端
                  Toast.show('微信绑定成功');
                  Navigator.of(context).pop();
                },
                icon: const Icon(Icons.wechat),
                label: const Text('微信授权绑定'),
                style: ElevatedButton.styleFrom(
                  backgroundColor: Colors.green,
                  minimumSize: const Size(double.infinity, 48),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}