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

namespace QYMessageCenter.Client.Converters
{
    public class AppCodeConverter : IValueConverter
    {
        private IDictionary<string, string> codeDic;

        public AppCodeConverter()
        {
            codeDic = new Dictionary<string, string>()
            {
                { "PJZS", "评价助手" },
                { "BBWYC", "步步为盈C端" },
                { "BBWYB", "步步为盈B端" },
                { "QK", "齐库" },
                { "LK", "良库" },
                { "SBF", "三板斧" },
                { "SN", "司南" },
            };
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var appCode = value?.ToString() ?? string.Empty;
            if (codeDic.TryGetValue(appCode, out var appName))
                return appName;
            else return "UnKnow App";
        }

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