import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gifunavi/pages/debug/debug_controller.dart';

class DebugPage extends GetView<DebugController> {
  const DebugPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('デバッグモード'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Text('GPS信号強度'),
            const SizedBox(height: 20),
            Obx(
                  () => DropdownButton<String>(
                value: controller.gpsSignalStrength.value,
                onChanged: (value) {
                  controller.setGpsSignalStrength(value!);
                },
                items: ['high', 'medium', 'low']
                    .map<DropdownMenuItem<String>>((String value) {
                  return DropdownMenuItem<String>(
                    value: value,
                    child: Text(value),
                  );
                }).toList(),
              ),
            ),
            const SizedBox(height: 20),
            const Text('現在のGPS座標'),
            const SizedBox(height: 10),
            Obx(
                  () => Text(
                '緯度: ${controller.currentPosition.value?.latitude ?? '-'}, 経度: ${controller.currentPosition.value?.longitude ?? '-'}',
              ),
            ),
            const SizedBox(height: 20),
            const Text('現在のGPS精度'),
            const SizedBox(height: 10),
            Obx(
                  () => Text(
                '精度: ${controller.currentPosition.value?.accuracy.toStringAsFixed(2) ?? '-'} m',
              ),
            ),
            const SizedBox(height: 20),
            Obx(
                  () => ElevatedButton(
                onPressed: controller.toggleSimulationMode,
                child: Text(controller.isSimulationMode.value
                    ? 'シミュレーションモード'
                    : '標準モード'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}