using ImageMagick;
using Ocr.Tesseract.Interface;
using Process.Abstract;
using System.Collections.Generic;
using System.Linq;

namespace Ocr.Tesseract;

/// <summary>
/// Applies various transformation the the input images
/// </summary>
public abstract class ImageProcessor : Processor<MagickImage, MagickImage>
{
  /// <summary>
  /// Image processing configuration
  /// </summary>
  public IImageProcessorConfiguration Configuration { get; set; }

  /// <inheritdoc/>
  protected ImageProcessor(IImageProcessorConfiguration configuration)
  {
    Configuration = configuration;
  }

  /// <inheritdoc cref="Process(IEnumerable{MagickImage})" />
  public abstract IEnumerable<MagickImage> Process(MagickImage value);

  #region Overrides of Processor<MagickImage,IMagickImageValueProcessorSettings>

  /// <inheritdoc />
  public override IEnumerable<MagickImage> Process(IEnumerable<MagickImage> inputs)
  {
    return inputs.SelectMany(Process);
  }

  #endregion
}
