using ComPDFKit.PDFAnnotation;
using ComPDFKitViewer.PdfViewer;
using PDF_Office.Model;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
{
    class DynamicPropertyDialogViewModel : BindableBase, IDialogAware
    {
        public string Title => ".";

        public event Action<IDialogResult> RequestClose;
        public DelegateCommand CancelCommand { get; set; }

        public DelegateCommand ApplyCommnad { get; set; }
        public ObservableCollection<string> DateFormatList { get; set; }


        private bool isChecked = true;

        public bool IsChecked
        {
            get { return isChecked; }
            set
            {
                SetProperty(ref isChecked, value);
            }
        }
        private string author = "Kdan";

        public string Author
        {
            get { return author; }
            set
            {
                SetProperty(ref author, value);
            }
        }

        private int selectedIndex = 0;

        public int SelectedIndex
        {
            get { return selectedIndex; }
            set
            {
                SetProperty(ref selectedIndex, value);
            }
        }



        public DynamicPropertyDialogViewModel()
        {
            CancelCommand = new DelegateCommand(Cancel);
            ApplyCommnad = new DelegateCommand(Apply);
            DateFormatList = new ObservableCollection<string> 
            { 
                "Defualt", 
                "M/d", "M/d/yy", "M/d/yyyy", "MM/dd/yy","MM/dd/yyyy",
                "d/M/y","d/M/yyy","dd/MM/yy","dd/MM/yyy","MM/yy","MM/yyyy",
                "M.d.y","M.d.yyyy","MM.dd.yy","MM.dd.yyyy","MM/yy","MM/yyyy",
                "d.M.y","d.M.yyyy","dd.MM.yy","dd.MM.yyyy","yy-MM-dd","yyyy-MM-dd"
            };
        }
        private void Cancel()
        {
            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
        }

        private void Apply()
        {
            DialogParameters valuePairs = new DialogParameters();
            valuePairs.Add(ParameterNames.DataModel, this);
            RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
        }

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
            return;
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            return;
        }
    }
}
