using GitConverter.Lib.Models;
namespace GitConverter.Lib.Converters
{
///
/// Contract for a single converter implementation that knows how to transform a GIS input
/// artifact from one canonical format option to another.
///
///
///
/// Implementations of encapsulate the conversion logic for a
/// particular source/target format pair. The interface is intentionally small: callers
/// provide input and output paths along with canonical format option strings and the
/// converter returns a describing success or failure.
///
///
/// Error handling and diagnostics:
/// - Implementations should prefer returning
/// for known failure conditions (invalid inputs, missing files, validation errors, converter
/// failures) rather than throwing exceptions. This keeps higher-level callers and tests
/// deterministic and allows clear user-facing messages.
/// - Unexpected exceptions may still occur; converters should catch such exceptions where
/// appropriate, log diagnostic details, and return a failure result. Avoid letting
/// exceptions escape unless they represent truly unrecoverable framework-level failures.
///
///
/// Concurrency and thread-safety:
/// - The interface itself is stateless. Implementations should avoid relying on mutable
/// static state so multiple converter instances can be used concurrently by callers.
/// - If implementations maintain shared resources (e.g., caches, static drivers), they must
/// manage synchronization internally.
///
///
/// Side-effects and cleanup:
/// - Implementations may create or modify the provided
/// and . Converters should document whether they create
/// or remove temporary files and folders. When possible prefer to clean up intermediate
/// artifacts created during successful conversions and leave the temp folder intact only
/// when it existed prior to the run.
///
///
/// Runtime behavior in tests:
/// - Tests in this repository invoke the ConsoleApp entry point via Program.Run(string[])
/// and expect converters to return a rather than calling
/// Environment.Exit. Implementations must therefore not terminate the process.
///
///
public interface IConverter
{
///
/// Execute a conversion run.
///
/// Path to the input artifact. May be a single file or an archive.
/// Canonical source format option (e.g. "Shapefile").
/// Canonical target format option (e.g. "GeoJson").
/// Destination folder where output files should be written.
/// Temporary working folder for extraction and intermediates.
///
/// A describing success or failure. On success the result may
/// include informational text such as produced file paths; on failure it should include a
/// concise message suitable for user-facing diagnostics.
///
///
/// Implementations should validate inputs and return appropriate failure results for
/// missing/invalid arguments. The method must not call Environment.Exit or terminate
/// the process; it is expected to return a result so callers (including unit tests) can
/// assert on the outcome. If the converter requires additional configuration or logging it
/// should acquire those resources from the surrounding host rather than reaching into global
/// state.
///
ConversionResult Convert(
string gisInputFilePath,
string gisSourceFormatOption,
string gisTargetFormatOption,
string outputFolderPath,
string tempFolderPath);
}
}