using C1.WPF.PdfViewer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPF_Forschung_PDF_ComponentOne
{
    class QscPdfBookmark : Bookmark
    {
        public QscPdfBookmark Parent { get; set; }

        private Bookmark _bookmark;


        public QscPdfBookmark(Bookmark bookmark)
        {
            this._bookmark = bookmark;
        }

        public new string Title => _bookmark.Title;

        public new int Page => _bookmark.Page;

        public new IEnumerable<Bookmark> Children => _bookmark.Children;

        public string[] GetMultiLevelTitle()
        {
            List<string> result = new List<string>();
            List<QscPdfBookmark> parentHierarchy = new List<QscPdfBookmark>();

            QscPdfBookmark parent = this.Parent;
            while (parent != null)
            {
                parentHierarchy.Insert(0, parent);
                parent = parent.Parent;
            }

            foreach (QscPdfBookmark p in parentHierarchy)
            {
                result.Add(p.Title);
            }

            result.Add(this.Title);
            return result.ToArray();
        }
    }
}
