package com.fusi24.entryPermitScanner.data.api;

import com.fusi24.entryPermitScanner.config.Constant;
import com.fusi24.entryPermitScanner.data.entity.DataAuth;
import com.fusi24.entryPermitScanner.data.entity.DataDetail;
import com.fusi24.entryPermitScanner.data.entity.DataDevice;
import com.fusi24.entryPermitScanner.data.entity.DataEntryPermit;
import com.fusi24.entryPermitScanner.data.entity.DataResultRfid;
import com.fusi24.entryPermitScanner.data.entity.DataSite;
import com.fusi24.entryPermitScanner.data.entity.DataUser;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface RestService {

    @POST(Constant.BEATS_ENDPOINT + "/api/mobile/login/rfid")
    Observable<DataUser> userLogin(@Body DataAuth dataAuth);

    @GET(Constant.BEATS2_ENDPOINT + "/api/lookup")
    Observable<List<DataDetail>> getLookUp(@Query("filter[parent.code]") String code);

    @GET(Constant.BEATS2_ENDPOINT + "/api/location")
    Call<List<DataSite>> getDataSite(@Query("filter[type.id]") Integer typeId);

    @GET(Constant.SID2_ENDPOINT + "/api/entryPermit")
    Observable<List<DataEntryPermit>> getEntryPermit();

    @GET(Constant.SID2_ENDPOINT + "/api/entryRfid")
    Observable<List<DataDevice>> getDataDevice(@Query("filter[deviceId]") String deviceId,
                                               @Query("expand") String[] expand);

    @GET(Constant.SID2_ENDPOINT + Constant.RFID_NEW_ENDPOINT + "/permit/check/{number_rfid}")
    Observable<DataResultRfid> checkRfidCard(@Path("number_rfid") String numberRfid,
                                             @Query("entryPermitId") Integer permitId,
                                             @Query("rfidDeviceId") String rfidDeviceId,
                                             @Query("checkTypeId") Integer checkTypeId,
                                             @Query("longLat") String longLat,
                                             @Query("checkedBy") Integer userId,
                                             @Query("expand") String[] expand);

}
