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

using BeWo.Core;

using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;

namespace BeWo.Converter
{
    public class CustomerDCPrintURLConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var lDC = value as CompactCustomerDC;

            if (lDC == null)
            {
                return null;
            }

            string url = BeWoApp.SiteOfOrigin + "/ReportView.aspx?cOid=" + lDC.CustomerOid + "&type=" + Utils.EnumName(ReportTypes.CustomerData);

            url = BeWoWpfUtils.GetHTMLEncodedURL(url);
            return new Uri(url);
        }

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