using C4IT.FASD.Base;
using F4SD_AdaptableIcon.Enums;
using FasdCockpitBase.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace FasdDesktopUi.Basics.Converter
{
    public class RevisionStatusToAdaptableIconConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is enumQuickActionRevisionStatus revisionStatus))
                return null;

            switch (revisionStatus)
            {
                case enumQuickActionRevisionStatus.unknown:
                    if (targetType == typeof(enumInternIcons?))
                        return enumInternIcons.none;
                    break;
                case enumQuickActionRevisionStatus.inProgress:
                    if (targetType == typeof(enumInternGif?))
                        return enumInternGif.loadingSpinner;
                    break;
                case enumQuickActionRevisionStatus.finishedSuccessfull:
                    if (targetType == typeof(enumInternIcons?))
                        return enumInternIcons.status_good;
                    break;
                case enumQuickActionRevisionStatus.canceled:
                case enumQuickActionRevisionStatus.finishedWithError:
                    if(targetType == typeof(enumInternIcons?))
                        return enumInternIcons.status_bad;
                    break;
                default:
                    return null;
            }

            return null;
        }

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