package com.offline.music.playermp3.network;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface MusicApi {


    //首页数据
    @POST("youtubei/v1/browse?prettyPrint=false")
    @Headers("X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8")
    Observable<ResponseBody> getHomeData(@Body RequestBody requestBody);




    //首页更多数据
    @POST("youtubei/v1/browse")
    @Headers("X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8")
    Observable<ResponseBody> getHomeMoreData(@Query("ctoken") String token,
                                             @Query("continuation") String continuation,
                                             @Query("type") String type,
                                             @Query("itct") String itct,
                                             @Query("prettyPrint") boolean prettyPrint,@Body RequestBody requestBody);




    //    X-Goog-FieldMask: contents.singleColumnMusicWatchNextResultsRenderer.tabbedRenderer.watchNextTabbedResultsRenderer.tabs.tabRenderer.content.musicQueueRenderer.content.playlistPanelRenderer(continuations,contents(automixPreviewVideoRenderer,playlistPanelVideoRenderer(title,navigationEndpoint,longBylineText,shortBylineText,thumbnail,lengthText)))

   //获取播放列表(返回的是每首歌曲详情列表)
    @POST("youtubei/v1/next?prettyPrint=false")
    @Headers("X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8")
    Observable<ResponseBody> getMusicPlayPage(@Header("X-Goog-FieldMask") String customHeader, @Body RequestBody requestBody);



    //  "X-Goog-FieldMask:playabilityStatus.status,playerConfig.audioConfig,streamingData.adaptiveFormats,videoDetails.videoId,videoDetails.thumbnail"
    //获取播放音频资源url  "X-Goog-Api-Key:AIzaSyC9XL3ZjwddXya6X74dJOCTL-WEYFDNX30"
    @POST("youtubei/v1/player?prettyPrint=false")
    @Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"})
    Observable<ResponseBody> getMusicPlayUrl(@Body RequestBody requestBody);


    //首页分类项下的播放列表子页面 (类型1：单曲合集、2：专辑、3：音乐视频合集 ，不同类型返回数据结构有区别)
    @POST("youtubei/v1/browse?prettyPrint=false")
    @Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"})
    Observable<ResponseBody> getCategoryList(@Body RequestBody requestBody);





    @POST("youtubei/v1/music/get_search_suggestions?prettyPrint=false")
    @Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
            "X-Goog-FieldMask:contents.searchSuggestionsSectionRenderer.contents.searchSuggestionRenderer.navigationEndpoint.searchEndpoint.query"})
    Observable<ResponseBody> getSearchSuggestion(@Body RequestBody requestBody);




// "X-Goog-FieldMask:contents.tabbedSearchResultsRenderer.tabs.tabRenderer.content.sectionListRenderer.contents.musicShelfRenderer(continuations,contents.musicResponsiveListItemRenderer(flexColumns,fixedColumns,thumbnail,navigationEndpoint))"
    @POST("youtubei/v1/search?prettyPrint=false")
    @Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"})
    Observable<ResponseBody> getSearch(@Body RequestBody requestBody);

}
