// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/bean/Token.java
// public class Token implements Serializable {
// 
//     private String access_token;     // 用户令牌(获取相关数据使用)
//     private String token_type;       // 令牌类型
//     private int expires_in;          // 过期时间
//     private String refresh_token;    // 刷新令牌(获取新的令牌)
//     private int created_at;          // 创建时间
// 
//     public String getAccess_token() {
//         return access_token;
//     }
// 
//     public void setAccess_token(String access_token) {
//         this.access_token = access_token;
//     }
// 
//     public String getToken_type() {
//         return token_type;
//     }
// 
//     public void setToken_type(String token_type) {
//         this.token_type = token_type;
//     }
// 
//     public int getExpires_in() {
//         return expires_in;
//     }
// 
//     public void setExpires_in(int expires_in) {
//         this.expires_in = expires_in;
//     }
// 
//     public String getRefresh_token() {
//         return refresh_token;
//     }
// 
//     public void setRefresh_token(String refresh_token) {
//         this.refresh_token = refresh_token;
//     }
// 
//     public int getCreated_at() {
//         return created_at;
//     }
// 
//     public void setCreated_at(int created_at) {
//         this.created_at = created_at;
//     }
// 
//     @Override
//     public String toString() {
//         return "Token{" +
//                 "access_token='" + access_token + '\'' +
//                 ", token_type='" + token_type + '\'' +
//                 ", expires_in=" + expires_in +
//                 ", refresh_token='" + refresh_token + '\'' +
//                 ", created_at=" + created_at +
//                 '}';
//     }
// }
// 
// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/LoginEvent.java
// public class LoginEvent extends BaseEvent<Token> {
// 
//     /**
//      * @param uuid 唯一识别码
//      */
//     public LoginEvent(@Nullable String uuid) {
//         super(uuid);
//     }
// 
//     /**
//      * @param uuid  唯一识别码
//      * @param code  网络返回码
//      * @param token 实体数据
//      */
//     public LoginEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
//         super(uuid, code, token);
//     }
// }
// 
// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/RefreshTokenEvent.java
// public class RefreshTokenEvent extends BaseEvent<Token> {
//     /**
//      * @param uuid 唯一识别码
//      */
//     public RefreshTokenEvent(@Nullable String uuid) {
//         super(uuid);
//     }
// 
//     /**
//      * @param uuid  唯一识别码
//      * @param code  网络返回码
//      * @param token 实体数据
//      */
//     public RefreshTokenEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
//         super(uuid, code, token);
//     }
// }


import android.support.annotation.NonNull;
import com.gcssloop.diycode_sdk.api.login.bean.Token;
import com.gcssloop.diycode_sdk.api.login.event.LoginEvent;
import com.gcssloop.diycode_sdk.api.login.event.RefreshTokenEvent;
/*
 * Copyright 2017 GcsSloop
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Last modified 2017-03-08 01:01:18
 *
 * GitHub:  https://github.com/GcsSloop
 * Website: http://www.gcssloop.com
 * Weibo:   http://weibo.com/GcsSloop
 */

package com.gcssloop.diycode_sdk.api.login.api;



public interface LoginAPI {

    //--- login ------------------------------------------------------------------------------------

    /**
     * 登录时调用
     * 返回一个 token，用于获取各类私有信息使用，该 token 用 LoginEvent 接收。
     *
     * @param user_name 用户名
     * @param password  密码
     * @see LoginEvent
     */
    String login(@NonNull String user_name, @NonNull String password);

    /**
     * 用户登出
     */
    void logout();

    /**
     * 是否登录
     * @return 是否登录
     */
    boolean isLogin();

    //--- token ------------------------------------------------------------------------------------

    /**
     * 刷新 token
     *
     * @see RefreshTokenEvent
     */
    String refreshToken();

    /**
     * 获取当前缓存的 token
     *
     * @return 当前缓存的 token
     */
// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/bean/Token.java
// public class Token implements Serializable {
// 
//     private String access_token;     // 用户令牌(获取相关数据使用)
//     private String token_type;       // 令牌类型
//     private int expires_in;          // 过期时间
//     private String refresh_token;    // 刷新令牌(获取新的令牌)
//     private int created_at;          // 创建时间
// 
//     public String getAccess_token() {
//         return access_token;
//     }
// 
//     public void setAccess_token(String access_token) {
//         this.access_token = access_token;
//     }
// 
//     public String getToken_type() {
//         return token_type;
//     }
// 
//     public void setToken_type(String token_type) {
//         this.token_type = token_type;
//     }
// 
//     public int getExpires_in() {
//         return expires_in;
//     }
// 
//     public void setExpires_in(int expires_in) {
//         this.expires_in = expires_in;
//     }
// 
//     public String getRefresh_token() {
//         return refresh_token;
//     }
// 
//     public void setRefresh_token(String refresh_token) {
//         this.refresh_token = refresh_token;
//     }
// 
//     public int getCreated_at() {
//         return created_at;
//     }
// 
//     public void setCreated_at(int created_at) {
//         this.created_at = created_at;
//     }
// 
//     @Override
//     public String toString() {
//         return "Token{" +
//                 "access_token='" + access_token + '\'' +
//                 ", token_type='" + token_type + '\'' +
//                 ", expires_in=" + expires_in +
//                 ", refresh_token='" + refresh_token + '\'' +
//                 ", created_at=" + created_at +
//                 '}';
//     }
// }
// 
// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/LoginEvent.java
// public class LoginEvent extends BaseEvent<Token> {
// 
//     /**
//      * @param uuid 唯一识别码
//      */
//     public LoginEvent(@Nullable String uuid) {
//         super(uuid);
//     }
// 
//     /**
//      * @param uuid  唯一识别码
//      * @param code  网络返回码
//      * @param token 实体数据
//      */
//     public LoginEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
//         super(uuid, code, token);
//     }
// }
// 
// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/RefreshTokenEvent.java
// public class RefreshTokenEvent extends BaseEvent<Token> {
//     /**
//      * @param uuid 唯一识别码
//      */
//     public RefreshTokenEvent(@Nullable String uuid) {
//         super(uuid);
//     }
// 
//     /**
//      * @param uuid  唯一识别码
//      * @param code  网络返回码
//      * @param token 实体数据
//      */
//     public RefreshTokenEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
//         super(uuid, code, token);
//     }
// }


// Path: sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/api/LoginAPI.java
import android.support.annotation.NonNull;
import com.gcssloop.diycode_sdk.api.login.bean.Token;
import com.gcssloop.diycode_sdk.api.login.event.LoginEvent;
import com.gcssloop.diycode_sdk.api.login.event.RefreshTokenEvent;

/*
 * Copyright 2017 GcsSloop
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Last modified 2017-03-08 01:01:18
 *
 * GitHub:  https://github.com/GcsSloop
 * Website: http://www.gcssloop.com
 * Weibo:   http://weibo.com/GcsSloop
 */

package com.gcssloop.diycode_sdk.api.login.api;



public interface LoginAPI {

    //--- login ------------------------------------------------------------------------------------

    /**
     * 登录时调用
     * 返回一个 token，用于获取各类私有信息使用，该 token 用 LoginEvent 接收。
     *
     * @param user_name 用户名
     * @param password  密码
     * @see LoginEvent
     */
    String login(@NonNull String user_name, @NonNull String password);

    /**
     * 用户登出
     */
    void logout();

    /**
     * 是否登录
     * @return 是否登录
     */
    boolean isLogin();

    //--- token ------------------------------------------------------------------------------------

    /**
     * 刷新 token
     *
     * @see RefreshTokenEvent
     */
    String refreshToken();

    /**
     * 获取当前缓存的 token
     *
     * @return 当前缓存的 token
     */
    Token getCacheToken();