using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Client.ClientBase;

namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters;

/// <summary>
/// 配方参数权限转换为IsEnabled属性值的转换器。
/// </summary>
public class PermissionToIsEnabledConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is MenuPermissionEnum perm)
            return perm == MenuPermissionEnum.MP_READ_WRITE;

        return false;
    }

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