﻿using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
using HeartWatch.Runtime.Helpers;

namespace HeartWatch.Runtime.Converters
{
    public class LevelToBrushConverter : DependencyObject, IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var s = value as string;
            if (s == null)
                return value;

            switch (s.Length)
            {
                case 1:
                    return new SolidColorBrush(Portable.Constants.HwYellowColor.ToNativeColor());
                case 2:
                    return new SolidColorBrush(Portable.Constants.HwOrangeColor.ToNativeColor());
                case 3:
                    return new SolidColorBrush(Portable.Constants.HwRedColor.ToNativeColor());
                default:
                    return value;
            }
        }

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