﻿using System;
using System.Windows.Input;
using Xamarin.Forms;

namespace NoteTakerPlus
{
	public class ParentNotesMV : NoteCollectionAutomaticUpdate<ListCellNote>
	{
		public ParentNotesMV(Note childNote) : base(e => e.Parent == 0 && e.Id != childNote.Id && e.Completed == false)
		{
			SelectNote = new Command((obj) => { childNote.Parent = ((ListCellNote)obj).Id; Navigation.PopAsync(); });
			NoParent = new Command(() => { childNote.Parent = 0; Navigation.PopAsync(); });
		}

		public ICommand SelectNote
		{ get; private set; }

		public ICommand NoParent
		{ get; private set; }

		public INavigation Navigation
		{ get; set; }
	}
}
