using FasdDesktopUi.Basics.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace FasdDesktopUi.Basics.Converter
{
    [ValueConversion(typeof(cDataCanvasDataModel), typeof(bool))]
    public class DataCanvasIsCloseButtonVisibileConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is cDataCanvasDataModel data) || !(parameter is enumDataCanvasTypes dataCanvasType))
                return null;

            bool output = false;

            switch (dataCanvasType)
            {
                case enumDataCanvasTypes.recommendation:
                    if (data.QuickActionStatusMonitorData == null && data.DetailedData == null)
                        output = true;
                    break;
                case enumDataCanvasTypes.detailedData:
                    if (data.QuickActionStatusMonitorData == null)
                        output = true;
                    break;
                case enumDataCanvasTypes.quickActionStatusMonitor:
                    output = true;
                    break;
            }

            return output;
        }

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

    public enum enumDataCanvasTypes
    {
        recommendation = 0,
        detailedData,
        quickActionStatusMonitor
    }
}
