import 'package:flutter/material.dart';

import '../theme/app_theme.dart';

enum ConnectivityStatus { online, offline, unknown }

Color statusColor(ConnectivityStatus status, AppTokens tokens) {
  switch (status) {
    case ConnectivityStatus.online:
      return tokens.statusOnline;
    case ConnectivityStatus.offline:
      return tokens.statusOffline;
    case ConnectivityStatus.unknown:
      return tokens.mutedForeground;
  }
}


class StatusDot extends StatelessWidget {
  final ConnectivityStatus status;
  final double size;

  const StatusDot({super.key, required this.status, this.size = 9});

  @override
  Widget build(BuildContext context) {
    final tokens = context.appTokens;
    final color = statusColor(status, tokens);
    return AnimatedContainer(
      duration: const Duration(milliseconds: 220),
      width: size,
      height: size,
      decoration: BoxDecoration(
        color: color,
        shape: BoxShape.circle,
        boxShadow: [
          BoxShadow(
            color: color.withValues(alpha: 0.5),
            blurRadius: 4,
            spreadRadius: 0.5,
          ),
        ],
      ),
    );
  }
}
