/*
 * Copyright (c) 2015. Ncomz. All Rights Reserved
 */

package com.ntels.onecable.admin.common.http;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * <pre>
 * 1. ClassName :   Response
 * 2. FileName  :   Response.java
 * 3. Package   :   com.ntels.onecable.admin.common.http
 * 4. Date      :   2016-12-06
 * 5. Author    :   aaron
 * 6. Comment   :   Initialize
 * </pre>
 */
public class Response implements Parcelable {

    public static final int OK = 200;
    public static final int CREATED = 201;
    public static final int BAD_REQUEST = 400;

    int statusCode;
    String message;
    String content;

    public static final Parcelable.Creator<Response> CREATOR = new Parcelable.Creator<Response>() {
        public Response createFromParcel(Parcel in) {
            return new Response(in);
        }

        public Response[] newArray(int size) {
            return new Response[size];
        }
    };

    /**
     * 생성자.
     *
     * @param statusCode HTTP response status code
     * @param message    HTTP response message
     * @param content    HTTP response content
     */
    public Response(int statusCode, String message, String content) {
        this.statusCode = statusCode;
        this.message = message;
        this.content = content;
    }

    /**
     * 생성자.
     *
     * @param in {@link Parcel}
     */
    private Response(Parcel in) {
        statusCode = in.readInt();
        message = in.readString();
        content = in.readString();
    }

    /**
     * {@link #statusCode} getter.
     *
     * @return HTTP response status code
     */
    public int getStatusCode() {
        return statusCode;
    }

    /**
     * {@link #message} getter.
     *
     * @return HTTP response message
     */
    public String getMessage() {
        return message;
    }

    /**
     * {@link #content} getter.
     *
     * @return HTTP response content
     */
    public String getContent() {
        return content;
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(statusCode);
        out.writeString(message);
        out.writeString(content);
    }
}
