using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZionVault.Basic;
using ZionVault.Binder.OCR;

namespace ZionGraphics.Pdf.Text
{
    class StringAndRect
    {
        public String Value { get; set; }
        public ZionVault.Basic.Location Location { get; set; }

        public StringAndRect(string value, Location location)
        {
            Value = value;
            Location = location;
        }
    }

    class LineContent
    {
        private List<StringAndRect> strings;

        public StringBuilder stringBuilder = new StringBuilder();
        public List<ZionVault.Binder.OCR.Word> Words
        {
            get
            {
                List<ZionVault.Binder.OCR.Word> result = new List<ZionVault.Binder.OCR.Word>();
                int index = 1;
                strings.OrderBy(x => x.Location.Left).ToList().ForEach(str => {
                    result.Add(new Word(index, 100, str.Location, str.Value));
                    index++;                
                });
                return result;
            }
        }
        
        public LineContent()
        {
            stringBuilder = new StringBuilder();
            strings = new List<StringAndRect>();
        }

        public void Add(StringAndRect word)
        {
            strings.Add(word);
        }

    }
}
