package com.littlesparkle.growler.library.user.driver;


import com.littlesparkle.growler.library.http.DefaultResponse;
import com.littlesparkle.growler.library.http.Request;

import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import rx.Observable;

public class DriverRequest extends Request<DriverRequest.DriverApi> {

    @Override
    protected Class<DriverApi> getServiceClass() {
        return DriverApi.class;
    }

    public interface DriverApi {
        @GET("driver/info")
        Observable<DriverSignInResponse> getInfo(
                @Field("user_id") int userId,
                @Field("token") String token
        );

        @POST("driver/online")
        @FormUrlEncoded
        Observable<DefaultResponse> online(
                @Field("user_id") int userId,
                @Field("token") String token
        );

        @POST("driver/offline")
        @FormUrlEncoded
        Observable<DefaultResponse> offline(
                @Field("user_id") int userId,
                @Field("token") String token
        );

        @POST("driver/rate")
        @FormUrlEncoded
        Observable<DefaultResponse> rate(
                @Field("user_id") int userId,
                @Field("token") String token,
                @Field("order_id") int orderId,
                @Field("rate") int rate
        );

        @POST("user/signup")
        @FormUrlEncoded
        Observable<DriverSignUpResponse> signup(
                @Field("mobile") String mobile,
                @Field("password") String password,
                @Field("auth_code") String auth_code
        );

        @POST("user/signin")
        @FormUrlEncoded
        Observable<DriverSignInResponse> signin(
                @Field("mobile") String mobile,
                @Field("password") String password
        );

    }
}

@@ -167,16 +167,82 @@
 Request;
+%0Aimport com.littlesparkle.growler.library.user.UserSignUpResponse;
 %0A%0Aimport
@@ -378,16 +378,143 @@
 ervable;
+%0Aimport rx.Subscriber;%0Aimport rx.Subscription;%0Aimport rx.android.schedulers.AndroidSchedulers;%0Aimport rx.schedulers.Schedulers;
 %0A%0Apublic
@@ -643,16 +643,16 @@
 ass() %7B%0A
-
         
@@ -682,16 +682,435 @@
 %0A    %7D%0A%0A
+    public Subscription signup(Subscriber%3CDriverSignUpResponse%3E subscriber,%0A                               String mobile, String password, String auth_code) %7B%0A        return mService.signup(mobile, password, auth_code)%0A                .subscribeOn(Schedulers.io())%0A                .observeOn(AndroidSchedulers.mainThread())%0A                .unsubscribeOn(Schedulers.io())%0A                .subscribe(subscriber);%0A    %7D%0A%0A
     publ

modify driver request