using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

using BeWo.ServiceProxy;

using BS.Shared.DataContracts;

namespace BeWo.Converter
{
    public class AssessmentSheetCategory2VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var cat = (AssessmentSheetCategoryDC) value;
            var collapsed = false;
            ServiceFacade.DoEmployeeServiceSync(s =>
                {
                    collapsed = s.IsAssessmentSheetCategoryBelongingToAS(cat.AssessmentSheetCategoryOid.Value);
                });

            return collapsed ? Visibility.Collapsed : Visibility.Visible;
        }

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