package org.ntlab.acanthus_client.resources.accounts;

import org.ntlab.acanthus_client.entities.Account;
import org.ntlab.acanthus_client.entities.AccountJson;
import org.ntlab.acanthus_client.entities.AccountUidJson;

import java.util.Collection;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

//-----------------------------------------------------------------
// RestAPI: accounts, accounts/{uid}
public interface AccountsRest {
    //-----------------------------------------------------------------
    // 全ユーザーの uid/name を取得
    @GET("accounts")
    Call<Collection<AccountJson>> getAccounts(
            @Query("name") String name
    );
    //-----------------------------------------------------------------
    // アカウントの新規作成
    @FormUrlEncoded
    @POST("accounts")
    Call<AccountUidJson> createAccount(
            @Field("name")String name,
            @Field("email")String email,
            @Field("password")String password
    );
    //-----------------------------------------------------------------
    // 対応するuidのユーザーの取得
    @GET("accounts/{uid}")
    Call<Account> getAccountByUid(
            @Path("uid")String uidStr,
            @Query("token")String token
    );

    //-----------------------------------------------------------------
}
