namespace PhotoRenamer;

public static class FilesHelper
{
    private static readonly string[] SupportedFileExtensions = { ".jpg", ".cr2", ".mp4" };

    public static IEnumerable<string> FindSupportedFilesRecursively(string path)
    {
        var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
        foreach (var file in files)
        {
            var fileExt = Path.GetExtension(file);
            if (fileExt is null)
                continue;
            foreach (var supportedFileExtension in SupportedFileExtensions)
            {
                if (fileExt.Equals(supportedFileExtension, StringComparison.InvariantCultureIgnoreCase))
                    yield return file;
            }
        }
    }
}
