using Microsoft.Maui.Controls;
using System.Globalization;

namespace TodoList.Maui.Converters
{
    public class PriorityToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string priority)
            {
                return priority switch
                {
                    "高" => Color.FromRgb(255, 205, 210),
                    "中" => Color.FromRgb(255, 224, 178),
                    "低" => Color.FromRgb(200, 230, 201),
                    _ => Colors.White
                };
            }
            return Colors.White;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
