package cy.hexor.furumi.data.remote

import javax.inject.Inject

class PlayerEndpoints @Inject constructor() {
    fun artists(baseUrl: String): String = "$baseUrl$ARTISTS_PATH"

    fun artistDetail(baseUrl: String, artistId: Long): String = "$baseUrl$ARTISTS_PATH/$artistId"

    fun releaseDetail(baseUrl: String, releaseId: Long): String = "$baseUrl$RELEASES_PATH/$releaseId"

    fun search(baseUrl: String): String = "$baseUrl$SEARCH_PATH"

    fun history(baseUrl: String): String = "$baseUrl$HISTORY_PATH"

    fun likesToggle(baseUrl: String, trackId: Long): String = "$baseUrl$LIKES_TOGGLE_PATH/$trackId"

    fun likes(baseUrl: String): String = "$baseUrl$LIKES_PATH"

    fun recordHistory(baseUrl: String): String = "$baseUrl$HISTORY_PATH"

    fun playlists(baseUrl: String): String = "$baseUrl$PLAYLISTS_PATH"

    fun playlistDetail(baseUrl: String, playlistId: Long): String = "$baseUrl$PLAYLISTS_PATH/$playlistId"

    fun offlineManifest(baseUrl: String): String = "$baseUrl$OFFLINE_MANIFEST_PATH"

    fun tracksByIds(baseUrl: String): String = "$baseUrl$TRACKS_BY_IDS_PATH"

    fun addPlaylistTracks(baseUrl: String, playlistId: Long): String = "$baseUrl$PLAYLISTS_PATH/$playlistId/tracks"

    fun sharePlaylist(baseUrl: String): String = "$baseUrl$SHARE_PLAYLIST_PATH"

    fun shareTrack(baseUrl: String, trackId: Long): String = "${baseUrl.trimEnd('/')}$SHARE_TRACK_PATH/$trackId"

    fun devicesPoll(baseUrl: String): String = "$baseUrl$DEVICES_POLL_PATH"

    fun devicesActive(baseUrl: String): String = "$baseUrl$DEVICES_ACTIVE_PATH"

    fun devicesCommand(baseUrl: String): String = "$baseUrl$DEVICES_COMMAND_PATH"

    fun jams(baseUrl: String): String = "$baseUrl$JAMS_PATH"

    fun jamsJoin(baseUrl: String): String = "$baseUrl$JAMS_JOIN_PATH"

    fun jamsLeave(baseUrl: String): String = "$baseUrl$JAMS_LEAVE_PATH"

    fun jamsUsers(baseUrl: String): String = "$baseUrl$JAMS_USERS_PATH"

    fun jamsInvite(baseUrl: String): String = "$baseUrl$JAMS_INVITE_PATH"

    companion object {
        private const val ARTISTS_PATH = "/api/player/artists"
        private const val RELEASES_PATH = "/api/player/releases"
        private const val SEARCH_PATH = "/api/player/search"
        private const val HISTORY_PATH = "/api/player/history"
        private const val LIKES_PATH = "/api/player/likes"
        private const val LIKES_TOGGLE_PATH = "/api/player/likes/toggle"
        private const val PLAYLISTS_PATH = "/api/player/playlists"
        private const val OFFLINE_MANIFEST_PATH = "/api/player/offline/manifest"
        private const val TRACKS_BY_IDS_PATH = "/api/player/tracks-by-ids"
        private const val SHARE_PLAYLIST_PATH = "/api/player/share-playlist"
        private const val SHARE_TRACK_PATH = "/share/track"
        private const val DEVICES_POLL_PATH = "/api/player/devices/poll"
        private const val DEVICES_ACTIVE_PATH = "/api/player/devices/active"
        private const val DEVICES_COMMAND_PATH = "/api/player/devices/command"
        private const val JAMS_PATH = "/api/player/jams"
        private const val JAMS_USERS_PATH = "/api/player/jams/users"
        private const val JAMS_JOIN_PATH = "/api/player/jams/join"
        private const val JAMS_INVITE_PATH = "/api/player/jams/invite"
        private const val JAMS_LEAVE_PATH = "/api/player/jams/leave"
    }
}
