using System.Globalization;
using System.Text;
using ICU4N.Text;
using Microsoft.AspNetCore.Mvc;

namespace Kynareth.Managers;

public class ImageModifier
{
	protected static BreakIterator lineBreakIterator = BreakIterator.GetLineInstance(CultureInfo.InvariantCulture);
	
	protected string GetText(string text)
	{
		StringBuilder newText = new();
		
		// set the text to be broken
		lineBreakIterator.SetText(text);

		// get the first boundary
		int start = lineBreakIterator.First();

		// iterate over all boundaries
		for (int end = lineBreakIterator.Next(); end != BreakIterator.Done; start = end, end = lineBreakIterator.Next())
		{
			// get the current line
			string line = text.Substring(start, end - start);

			// do something with the line
			newText.AppendLine(line);
			Console.WriteLine(line);
		}

		return newText.ToString();
	}
	
	protected ObjectResult GetResult(int statusCode, object data) 
		=> new(data) { StatusCode = statusCode };
}