namespace Sonex.Services.ImageSync;

internal enum ImageSyncMode
{
    Watch,
    ScanOnce
}

internal static class ImageSyncModeExtensions
{
    public static ImageSyncMode Parse(string[] args)
    {
        if (args.Length == 0)
            return ImageSyncMode.Watch;

        string mode = (args[0] ?? string.Empty).Trim().ToLowerInvariant();

        return mode switch
        {
            "watch" or "w" or "--watch" => ImageSyncMode.Watch,
            "scan-once" or "scan" or "--scan-once" or "--scan" => ImageSyncMode.ScanOnce,
            _ => throw new ArgumentException($"Unknown mode '{args[0]}'. Supported values: watch, scan-once.")
        };
    }
}
