package com.zxhl.cms.net.api

import com.zxhl.cms.ad.upload.model.Response
import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.net.model.box.*
import com.zxhl.cms.net.model.chat.*
import com.zxhl.cms.net.model.other.IsWeChatLoginEntity
import com.zxhl.cms.net.model.other.WxBindEntity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.net.model.uc.VersionEntity
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.*


interface IHomeApi {

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_LIST)
    fun getHomelist(
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("free") free: Int,
        @Query("category") category: String
    ): Observable<Response<List<HomeListEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_USER_INFO)
    fun getUserInfo(
        @Query("userId") userId: String?,
        @Query("free") free: String?
    ): Observable<Response<HomeListEntity>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_USER_LIKE)
    fun likeUser(
        @Query("userId") userId: String?,
        @Query("free") free: String?
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_USER_FOLLOW)
    fun followUser(
        @Query("userId") userId: String?
    ): Observable<Response<Any>>

    @Multipart
    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_ADD_USERINFO)
    fun addUserInfo(
        @Query("birthday") birthday: String,
        @Query("invitationCode") invitationCode: String,
        @Query("nickname") nickname: String,
        @Query("sex") sex: String,
        @Part headImage: MultipartBody.Part?
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_ADD_USERINFO)
    fun addUserInfoNoHeadImg(
        @Query("birthday") birthday: String,
        @Query("invitationCode") invitationCode: String,
        @Query("nickname") nickname: String,
        @Query("sex") sex: String
    ): Observable<Response<Any>>

    @Multipart
    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserInfo(
        @Query("birthday") birthday: String,
        @Query("description") description: String,
        @Part headImage: MultipartBody.Part?,
        @Query("height") height: String,
        @Query("income") income: String,
        @Query("nickname") nickname: String,
        @Query("occupation") occupation: String,
        @Query("province") province: String,
        @Query("weight") weight: String
    ): Observable<Response<Any>>

    @Multipart
    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserHeadImg(
        @Part headImage: MultipartBody.Part?
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserNickName(
        @Query("nickname") nickname: String,
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserGender(
        @Query("sex") sex: String,
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserAge(
        @Query("age") age: String,
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
    fun updateUserDescrption(
        @Query("description") description: String,
    ): Observable<Response<Any>>

    @Multipart
    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_VOICE)
    fun updateUserVoice(
        @Query("voiceTime") voiceTime: String,
        @Part voice: MultipartBody.Part?
    ): Observable<Response<UserInfo>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO_NO_HEAD_IMG)
    fun updateUserInfoNoHeadImg(
        @Query("birthday") birthday: String,
        @Query("description") description: String,
        @Query("height") height: String,
        @Query("income") income: String,
        @Query("nickname") nickname: String,
        @Query("occupation") occupation: String,
        @Query("province") province: String,
        @Query("weight") weight: String
    ): Observable<Response<Any>>

    @Multipart
    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPLOAD)
    fun upload(
        @Part file: MultipartBody.Part?
    ): Observable<Response<PictureEntity>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_PICTURES)
    fun updatePictures(
        @Query("picturesList") picturesList: String?
    ): Observable<Response<Any>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_FOLLOWLIST)
    fun getFollowList(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<FollowEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_FANLIST)
    fun getFanList(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<FollowEntity>>>

//    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_LIKEMYLIST)
//    fun getMyLikeList(
//        @Query("page") page: Int,
//        @Query("size") size: Int,
//        @Query("free") free: Int,
//    ): Observable<Response<List<FollowEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_MY_LIKE_LIST)
    fun getMyLikeList(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<FollowEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_MESSAGE_LIST)
    fun getMessageList(
        @Query("assistFlags") assistFlags: String,
        @Query("startIndex") startIndex: String,
        @Query("startIndex") timeStamp: String,
        @Query("topStartIndex") topStartIndex: String,
        @Query("topTimeStamp") topTimeStamp: String
    ): Observable<Response<Any>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_GET_ADMIN_KEY)
    fun getAdminKey(): Observable<Response<IMSignEntity>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_VISITOR)
    fun getVisitor(
        @Query("page") page: Int,
        @Query("size") size: Int,
        @Query("free") free: Int
    ): Observable<Response<List<VisitorEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_MEMBER_RECORD)
    fun getMemberRecord(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<RecordEntity>>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_COIN_LOG)
    fun getCoinLog(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<RecordEntity>>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_RECEIVE_NEW_USER)
    fun receiveNewUser(): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_REPORT)
    fun report(
        @Query("content") content: String,
        @Query("userId") userId: String?
    ): Observable<Response<Any>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_SIGN_FEED_BACK)
    fun feedback(
        @Query("content") content: String
    ): Observable<Response<Any>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_SIGN_LIST)
    fun getSingList(): Observable<Response<SignEntity>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_SIGN_RECEIVE)
    fun getSignReceive(): Observable<Response<SignReceiveEntity>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_RECOMMEND_CHAT_UP)
    fun getRecommendChat(): Observable<Response<RecommendEntity>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_SYNC_POSITION)
    fun syncPositon(
        @Query("latitude") latitude: String,
        @Query("longitude") longitude: String,
        @Query("city") city: String
    ): Observable<Response<LocationEntity>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_GET_DISTANCE)
    fun getDistance(
        @Query("free") free: Int,
        @Query("userId") userId: String?
    ): Observable<Response<DistanceEntity>>

    @POST(NetConfig.StarLight.HOME_STAR_LIGHT_ONE_CLICK_CHAT_UP)
    fun oneclickChatUp(
        @Query("userIds") userIds: String
    ): Observable<Response<OneChatUpEntity>>

    @GET(NetConfig.Box.HOME_BOX_VERIFICATION)
    fun getVerfication(
    ): Observable<Response<VerifacationEntity>>

    //判断用户是否微信登录
    @GET(NetConfig.User.USER_IS_WX_LOGIN)
    fun isWxLogin(): Observable<Response<IsWeChatLoginEntity>>

    //绑定微信
    @POST(NetConfig.User.AUTH_WX_LOGIN)
    fun bindWx(
        @Query("openid") oppenid: String,
        @Query("accessToken") token: String
    ): Observable<Response<WxBindEntity>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_MESSAGE_LOG)
    fun getMessageLosg(
        @Query("lastMsgKey") lastMsgKey: String,
        @Query("userId") userId: String
    ): Observable<Response<ChatMessageEntity>>

    @GET(NetConfig.Box.HOME_BOX_APP_INFO)
    fun getAppInfo(): Observable<Response<AppInEntity>>

    /**
     * 获取验证码
     *
     * @return
     */
    @POST(NetConfig.User.USER_SEND_CODE)
    fun requestCode(@Query("phoneNo") phone: String): Observable<Response<Any>>

    /**
     * 验证码登录
     *
     * @return
     */
    @POST(NetConfig.User.USER_PHONE_CODE_LOGIN)
    fun requestCodeLogin(
        @Query("phoneNo") phone: String,
        @Query("code") code: String
    ): Observable<Response<UserInfo>>

    @GET(NetConfig.User.URL_VERSION)
    fun getVersion(): Observable<Response<VersionEntity?>>

    @GET(NetConfig.User.URL_AUTH_LOGOUT)
    fun authLogout(): Observable<Response<Any?>>


    @POST(NetConfig.User.URL_AUTH_GOOGLE_LOGIN)
    fun authGoogleLogin(
        @Query("userID") userID: String?,
        @Query("nickname") nickname: String?,
        @Query("picture") picture: String?
    ): Observable<Response<WxBindEntity?>>

    @POST(NetConfig.User.URL_AUTH_FACEBOOK_LOGIN)
    fun authFaceBookLogin(
        @Query("userID") userID: String?,
        @Query("nickname") nickname: String?,
        @Query("picture") picture: String?
    ): Observable<Response<WxBindEntity?>>

    @GET(NetConfig.StarLight.HOME_STAR_LIGHT_BLACKLIST)
    fun getBlackList(
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Observable<Response<List<FollowEntity>>>

    @POST(NetConfig.StarLight.HOME_STAR_BLACK)
    fun blackUser(
        @Query("userId") userId: String?
    ): Observable<Response<Any>>

    @GET(NetConfig.StarLight.HOME_STAR_CONSTELLATION_PAIRING)
    fun getConstellation(@Query("date") date: String?): Observable<Response<ConstellationEntity>>

    @POST(NetConfig.StarLight.HOME_STAR_CONSTELLATION_RESLUT)
    fun getStarMachReslut(): Observable<Response<StarMachEntity>>
}