import 'package:flutter/material.dart';
import '../../core/theme/app_theme.dart';

/// 状态指示器组件 - 明亮工业风格
class StatusIndicator extends StatelessWidget {
  final String text;
  final DeviceStatusType status;
  final double size;

  const StatusIndicator({
    super.key,
    required this.text,
    required this.status,
    this.size = 10,
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          width: size,
          height: size,
          decoration: BoxDecoration(
            shape: BoxShape.circle,
            color: _getStatusColor(),
          ),
        ),
        const SizedBox(width: 6),
        Text(
          text,
          style: TextStyle(
            color: _getStatusColor(),
            fontWeight: FontWeight.w600,
            fontSize: 13,
          ),
        ),
      ],
    );
  }

  Color _getStatusColor() {
    switch (status) {
      case DeviceStatusType.running:
        return AppTheme.statusRunning;
      case DeviceStatusType.idle:
        return AppTheme.statusStopped;
      case DeviceStatusType.paused:
        return AppTheme.statusPaused;
      case DeviceStatusType.error:
        return AppTheme.statusError;
      case DeviceStatusType.success:
        return AppTheme.statusRunning;
    }
  }
}

enum DeviceStatusType { running, idle, paused, error, success }
