package de.oaa.libredeck.web.service.streaming;

import java.io.IOException;
import java.util.List;

import de.oaa.libredeck.web.model.Track;

public interface StreamingProvider {

    String getId();

    String getDisplayName();

    /** Returns true if this provider can handle the given playlist URL. */
    boolean supportsUrl(String url);

    /** Extracts the playlist ID from a provider URL. */
    String extractPlaylistId(String url);

    /** Fetches the playlist title by ID via the public API. */
    String fetchPlaylistTitle(String playlistId) throws IOException;

    /** Fetches all tracks for the given playlist ID via the public API. Year field is empty. */
    List<Track> fetchTracks(String playlistId) throws IOException;

    /**
     * Looks up the release year for a single track by its provider-specific ID.
     * Returns an empty string if no year can be determined.
     * Default implementation returns empty; override in providers that support it.
     */
    default String fetchTrackYear(String trackId) { return ""; }

    // -------------------------------------------------------------------------
    // OAuth methods – commented out until Deezer re-enables app registration.
    // Re-enable together with AuthController and the OAuth flow in DeezerProvider
    // when a Deezer app-id / app-secret becomes available.
    // -------------------------------------------------------------------------
    // import de.libredeck.web.model.OAuthToken;
    // import de.libredeck.web.model.PlaylistSummary;
    // String buildAuthorizationUrl(String state);
    // OAuthToken exchangeCode(String code) throws IOException;
    // List<PlaylistSummary> fetchPlaylists(String accessToken) throws IOException;
    // List<Track> fetchTracks(String accessToken, String playlistId) throws IOException;
}
