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

using BeWo.Core;
using BeWo.ViewModel;

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

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

            string url = BeWoApp.SiteOfOrigin + "/ReportView.aspx?ioid=" + lVM.DataContract.InvoiceBaseOid + "&type=CustomerInvoice";

            url = BeWoWpfUtils.GetHTMLEncodedURL(url);

            return new Uri(url);
        }

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