using System.Text.RegularExpressions;
using System.Threading.Tasks;

public abstract class SongValidatorBase : ISongValidator
{
    public abstract Task<Song> ValidateAsync(Uri songUri);

    public abstract Task<bool> CanExtractSongMetadataAsync(Uri songUri);

    public abstract Task<bool> CanValidateUriAsync(Uri songUri);

    public abstract SongProvider GetSongProvider();

    protected SpotifyApiClient _spotifyApiClient;

    protected ILogger _logger;

    public SongValidatorBase(ILogger logger, SpotifyApiClient spotifyApiClient)
    {
        _spotifyApiClient = spotifyApiClient;
        _logger = logger;

    }

    protected async Task<string> LookupSpotifyIdAsync(string songName, string songArtist)
    {
        var candidates = await _spotifyApiClient.GetTrackCandidatesAsync(songName, songArtist);
        return candidates.Any() ? candidates[0].Id : "";
    }
}