package site.ruiqiao.renrentou.service;

import java.util.List;
import java.util.Map;

import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import site.ruiqiao.renrentou.model.AdCompany;
import site.ruiqiao.renrentou.model.Advertisement;
import site.ruiqiao.renrentou.model.BasePage;
import site.ruiqiao.renrentou.model.ResponseDto;
import site.ruiqiao.renrentou.model.User;

/**
 * @author ruiqiao
 * @project Renrentou
 * @package site.ruiqiao.renrentou.service
 * @date 2017/9/9
 * @des
 */

public interface AdService {
    @GET("ad/page")
    Flowable<ResponseDto<BasePage<List<Advertisement>>>> getList(
            @Query("pageSize") int pageSize,
            @Query("pageNum") int pageNumber,
            @Query("title") String title,
            @Query("token") String token,
            @Query("state") String state
    );

    @GET("ad/page")
    Flowable<ResponseDto<BasePage<List<Advertisement>>>> getMyList(
            @Query("pageSize") int pageSize,
            @Query("pageNum") int pageNumber,
            @Query("owner") String owner,
            @Query("token") String token
    );
    @GET("ad/page")
    Flowable<ResponseDto<BasePage<List<Advertisement>>>> getMyCheckList(
            @Query("pageSize") int pageSize,
            @Query("pageNum") int pageNumber,
            @Query("owner") String owner,
            @Query("state") String state,
            @Query("token") String token
    );

    @GET("ad/hotbyorder")
    Flowable<ResponseDto<BasePage<List<Advertisement>>>> getHotList(
            @Query("pageSize") int pageSize,
            @Query("pageNum") int pageNumber,
            @Query("token") String token
    );

    @POST("ad/new")
    @Multipart
    Flowable<ResponseDto<User>> add(
            @PartMap Map<String, RequestBody> param,
            @Part MultipartBody.Part adFile,
            @Part MultipartBody.Part coverFile
    );

    @POST("ad/new")
    @Multipart
    Flowable<ResponseDto<User>> add(
            @PartMap Map<String, RequestBody> param,
            @Part MultipartBody.Part adFile
    );



    @POST("ad/delete")
    @Multipart
    Flowable<ResponseDto> delete(
            @PartMap Map<String, RequestBody> param
    );

    @GET("adcompany/page")
    Flowable<ResponseDto<BasePage<List<AdCompany>>>> getAdCompanyList(
            @Query("pageSize") int pageSize,
            @Query("pageNum") int pageNumber,
            @Query("name") String name,
            @Query("token") String token
    );

    @POST("sys/comments/zan")
    @FormUrlEncoded
    Flowable<ResponseDto> favorite(
            @Field("adId") String adId,
            @Field("token") String token
    );

}