using Gremlin.MVVM.ViewModels;
using System.Windows;

namespace Gremlin.MVVM.Views
{
	public partial class CheckNewCustomDescription : Window
	{
		public CustomDescriptionViewModel CustomDescriptionVM { get; set; }
		public LineItemViewModel LineItemVM { get; set; }

		public CheckNewCustomDescription(LineItemViewModel lineItemViewModel, CustomDescriptionViewModel customDescriptionViewModel)
		{
			InitializeComponent();

			LineItemVM = lineItemViewModel;
			ProductNumber.Text = LineItemVM.ProductNumber;
			OptionNumber.Text = LineItemVM.OptionNumber;
			SapShortDescription.Text = LineItemVM.SapShortDescription;

			CustomDescriptionVM = customDescriptionViewModel;
			CoverletterText.Text = customDescriptionViewModel.CoverletterText;
			DescriptionText.Text = customDescriptionViewModel.DescriptionText;
			Heading.Text = CustomDescriptionVM.Heading;
		}

		private void BtnOk_Click(object sender, RoutedEventArgs e)
		{
			CustomDescriptionVM.Heading = Heading.Text;
			CustomDescriptionVM.CoverletterText = CoverletterText.Text;
			CustomDescriptionVM.DescriptionText = DescriptionText.Text;

			DialogResult = true;
			Close();
		}

		private void BtnCancel_Click(object sender, RoutedEventArgs e)
		{
			DialogResult = false;
			Close();
		}
	}
}
