package com.phlx.anchorcollect.data.http;


import com.phlx.anchorcollect.entity.BreedingRecordDetailEntity;
import com.phlx.anchorcollect.entity.BreedingRecordEntity;
import com.phlx.anchorcollect.entity.CattleResumeEntity;
import com.phlx.anchorcollect.entity.DictEntity;
import com.phlx.anchorcollect.entity.GenData;
import com.phlx.anchorcollect.entity.ImmuneBatchEntity;
import com.phlx.anchorcollect.entity.ImmuneBatchDetailEntity;
import com.phlx.anchorcollect.entity.LoginData;
import com.phlx.anchorcollect.entity.MedicalRecordEntity;
import com.phlx.anchorcollect.entity.PerformanceEntity;
import com.phlx.anchorcollect.entity.WeightManEntity;
import com.phlx.anchorcollect.params.BaseResponse;
import com.phlx.anchorcollect.params.CollectResponse;
import com.phlx.anchorcollect.params.ListResponse;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;

/**
 * Created by goldze on 2017/6/15.
 */

public interface ApiService {

    /**
     * 获取版本号
     */
    @GET("/api/getAppVsesion?type=iPad")
    Observable<BaseResponse<Double>> versionGet();

    /**
     * 下载新版本
     */
    @GET("/api/download")
    Observable<BaseResponse> DownloadApp();

//    @Headers({"Content-Type: application/json", "Accept: application/json"})

    /**
     * 登录
     */
    @FormUrlEncoded
    @POST("/jwt/login")
    Observable<CollectResponse<LoginData>> loginPost(@FieldMap Map<String,String> map);

    /**
     * 获取页面配置
     */
    @GET("/api/gen/list")
    Observable<CollectResponse<GenData>> genGet();

    /**
     * 获取字典项列表
     */
    @POST("/api/dict/data/list")
    Observable<ListResponse<DictEntity>> downloadDict();

    /**
     * 获取基础信息列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/cattleresume/list")
    Observable<ListResponse<CattleResumeEntity>> downloadCattleList(@FieldMap Map<String, String> map);

    /**
     * 获取基础信息列表-返回
     */
//    @Headers({"Content-Type: application/json", "Accept: application/x-www-form-urlencoded;charset=UTF-8"})
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/cattleresume/sync/add")
    Observable<CollectResponse> downloadCattleListSync(@Body RequestBody body);

    /**
     * 获取性能测定列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/performance/list")
    Observable<ListResponse<PerformanceEntity>> downloadPerformanceList(@FieldMap Map<String, String> map);

    /**
     * 获取性能测定列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/performance/sync/add")
    Observable<CollectResponse> downloadPerformanceListSync(@Body RequestBody body);

    /**
     * 上传性能测定列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/performance/add")
    Observable<ListResponse<Long>> uploadPerformanceList(@Body RequestBody body);

    /**
     * 获取-配种记录主表-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/cattlematingMaster/list")
    Observable<ListResponse<BreedingRecordEntity>> downloadBreedingRecordList(@FieldMap Map<String, String> map);

    /**
     * 获取-配种记录主表-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/cattlematingMaster/sync/add")
    Observable<CollectResponse> downloadBreedingRecordListSync(@Body RequestBody body);

    /**
     * 上传-配种记录主表-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/cattlematingMaster/add")
    Observable<ListResponse<Long>> uploadBreedingRecordList(@Body RequestBody body);

    /**
     * 获取-配种记录子表-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/cattlematingDetaill/list")
    Observable<ListResponse<BreedingRecordDetailEntity>> downloadBreedingRecordDetailList(@FieldMap Map<String, String> map);

    /**
     * 获取-配种记录子表-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/cattlematingDetaill/sync/add")
    Observable<CollectResponse> downloadBreedingRecordDetailListSync(@Body RequestBody body);

    /**
     * 上传-配种记录子表-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/cattlematingDetaill/add")
    Observable<ListResponse<Long>> uploadBreedingRecordDetailList(@Body RequestBody body);

    /**
     * 获取-称重管理-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/weightMan/list")
    Observable<ListResponse<WeightManEntity>> downloadWeightManList(@FieldMap Map<String, String> map);

    /**
     * 获取-称重管理-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/weightMan/sync/add")
    Observable<CollectResponse> downloadWeightManListSync(@Body RequestBody body);

    /**
     * 上传-称重管理-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/weightMan/add")
    Observable<ListResponse<Long>> uploadWeightManList(@Body RequestBody body);

    /**
     * 获取-诊疗记录-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/medicalrecords/list")
    Observable<ListResponse<MedicalRecordEntity>> downloadMedicalRecordList(@FieldMap Map<String, String> map);

    /**
     * 获取-诊疗记录-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/medicalrecords/sync/add")
    Observable<CollectResponse> downloadMedicalRecordListSync(@Body RequestBody body);

    /**
     * 上传-诊疗记录-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/medicalrecords/add")
    Observable<ListResponse<Long>> uploadMedicalRecordList(@Body RequestBody body);

    /**
     * 获取-免疫记录-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/immunebatch/list")
    Observable<ListResponse<ImmuneBatchEntity>> downloadImmuneBatchList(@FieldMap Map<String, String> map);

    /**
     * 获取-免疫记录-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/immunebatch/sync/add")
    Observable<CollectResponse> downloadImmuneBatchListSync(@Body RequestBody body);

    /**
     * 上传-免疫记录-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/immunebatch/add")
    Observable<ListResponse<Long>> uploadImmuneBatchList(@Body RequestBody body);

    /**
     * 获取-免疫记录-子表-列表
     * SyncState 0根据记录更新，1重新更新
     */
    @FormUrlEncoded
    @POST("/api/immunebatchDetail/list")
    Observable<ListResponse<ImmuneBatchDetailEntity>> downloadImmuneBatchDetailList(@FieldMap Map<String, String> map);

    /**
     * 获取-免疫记录-子表-列表-返回
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/immunebatchDetail/sync/add")
    Observable<CollectResponse> downloadImmuneBatchDetailListSync(@Body RequestBody body);

    /**
     * 上传-免疫记录-子表-列表
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/immunebatchDetail/add")
    Observable<ListResponse<Long>> uploadImmuneBatchDetailList(@Body RequestBody body);

    /**
     * 上传-错误记录
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/api/error/add")
    Observable<CollectResponse> uploadErrorData(@Body RequestBody body);




}

