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

package com.ntels.onecable.common.http;

import android.os.Message;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * <pre>
 * 1. ClassName :   CustomRequest
 * 2. FileName  :   CustomRequest.java
 * 3. Package   :   com.ntels.onecable.common.http
 * 4. Date      :   2016-12-05
 * 5. Author    :   aaron
 * 6. Comment   :   Value object holding all mContext necessary for making a request.
 * </pre>
 */
public class CustomRequest {

    private static final String TAG = CustomRequest.class.getSimpleName();

    public static final String HTTP_METHOD_GET = "GET";
    public static final String HTTP_METHOD_PUT = "PUT";
    public static final String HTTP_METHOD_POST = "POST";
    public static final String HTTP_METHOD_DELETE = "DELETE";
    public static final String SEND_METHOD = "";
    public static final String SEND_METHOD_SMART = "SMART";
    public static final String SEND_METHOD_GEOFENCE = "GEOFENCE";
    public static final String HTTP_METHOD_MULTIPART = "MULTIPART";

    private String httpMethod;
    private String sendMethod;
    private String uriStr;
    // private String body;
    private String filePath;
    private ArrayList<String> alfilePath = null;
    private String fileParamName;
    private Message msg;
    private Boolean bDialog = false;
    private String authorization;
    private String authorization1;
    private String authorization2;
    private ArrayList<HashMap<String, Object>> alBody;
    private String body;

    /**
     * 생성자.
     *
     * @param bDialog       다이얼로그 표시 여부
     * @param httpMethod    HTTP method(ex> GET, POST...)
     * @param uriStr        Request uri string
     * @param authorization 사용자 authorization key
     * @param alBody        Request body data list
     * @param sendMethod    {@link #SEND_METHOD_SMART}, {@link #SEND_METHOD_GEOFENCE}
     */
    public CustomRequest(Boolean bDialog, String httpMethod, String uriStr, String authorization, ArrayList<HashMap<String, Object>> alBody, String sendMethod) {

        this.bDialog = bDialog;
        this.httpMethod = httpMethod;
        this.uriStr = uriStr;
        if (sendMethod.equals(SEND_METHOD_SMART)) {
            this.authorization1 = authorization;
        } else if (sendMethod.equals(SEND_METHOD_GEOFENCE)) {
            this.authorization2 = authorization;
        } else {
            this.authorization = authorization;
        }
        this.alBody = alBody;
        this.sendMethod = sendMethod;
    }

    /**
     * 생성자.
     *
     * @param bDialog       다이얼로그 표시 여부
     * @param httpMethod    HTTP method(ex> GET, POST...)
     * @param uriStr        Request uri string
     * @param authorization 사용자 authorization key
     * @param body          Request body data string
     * @param sendMethod    {@link #SEND_METHOD_SMART}, {@link #SEND_METHOD_GEOFENCE}
     */
    public CustomRequest(Boolean bDialog, String httpMethod, String uriStr, String authorization, String body, String sendMethod) {

        this.bDialog = bDialog;
        this.httpMethod = httpMethod;
        this.uriStr = uriStr;
        if (sendMethod.equals(SEND_METHOD_SMART)) {
            this.authorization1 = authorization;
        } else if (sendMethod.equals(SEND_METHOD_GEOFENCE)) {
            this.authorization2 = authorization;
        } else {
            this.authorization = authorization;
        }
        this.body = body;
        this.sendMethod = sendMethod;
    }

    /**
     * 생성자.
     *
     * @param bDialog       다이얼로그 표시 여부
     * @param httpMethod    HTTP method(ex> GET, POST...)
     * @param uriStr        Request uri string
     * @param authorization 사용자 authorization key
     * @param alBody        Request body data list
     * @param fileParamName File name
     * @param filePath      File path
     * @param sendMethod    {@link #SEND_METHOD_SMART}, {@link #SEND_METHOD_GEOFENCE}
     */
    public CustomRequest(Boolean bDialog, String httpMethod, String uriStr, String authorization, ArrayList<HashMap<String, Object>> alBody, String fileParamName, String filePath, String sendMethod) {

        this.bDialog = bDialog;
        this.httpMethod = httpMethod;
        this.uriStr = uriStr;
        if (sendMethod.equals(SEND_METHOD_SMART)) {
            this.authorization1 = authorization;
        } else if (sendMethod.equals(SEND_METHOD_GEOFENCE)) {
            this.authorization2 = authorization;
        } else {
            this.authorization = authorization;
        }
        this.alBody = alBody;
        this.fileParamName = fileParamName;
        this.filePath = filePath;
        this.sendMethod = sendMethod;
    }

    /**
     * 생성자.
     *
     * @param bDialog       다이얼로그 표시 여부
     * @param httpMethod    HTTP method(ex> GET, POST...)
     * @param uriStr        Request uri string
     * @param authorization 사용자 authorization key
     * @param alBody        Request body data list
     * @param fileParamName File name
     * @param alfilePath    File path list
     * @param sendMethod    {@link #SEND_METHOD_SMART}, {@link #SEND_METHOD_GEOFENCE}
     */
    public CustomRequest(Boolean bDialog, String httpMethod, String uriStr, String authorization, ArrayList<HashMap<String, Object>> alBody, String fileParamName, ArrayList<String> alfilePath, String sendMethod) {

        this.bDialog = bDialog;
        this.httpMethod = httpMethod;
        this.uriStr = uriStr;
        if (sendMethod.equals(SEND_METHOD_SMART)) {
            this.authorization1 = authorization;
        } else if (sendMethod.equals(SEND_METHOD_GEOFENCE)) {
            this.authorization2 = authorization;
        } else {
            this.authorization = authorization;
        }
        this.alBody = alBody;
        this.fileParamName = fileParamName;
        this.alfilePath = alfilePath;
        this.sendMethod = sendMethod;
    }

    /**
     * {@link #bDialog} getter.
     *
     * @return 다이얼로그 표시 여부
     */
    public Boolean getDialog() {

        return bDialog;
    }

    /**
     * {@link #bDialog} setter.
     *
     * @param bDialog 다이얼로그 표시 여부
     */
    public void setDialog(Boolean bDialog) {

        this.bDialog = bDialog;
    }

    /**
     * {@link #sendMethod} getter.
     *
     * @return {@link #SEND_METHOD}, {@link #SEND_METHOD_SMART}, {@link #SEND_METHOD_GEOFENCE}
     */
    public String getSendMethod() {

        return sendMethod;
    }

    /**
     * {@link #sendMethod} setter.
     *
     * @param sendMethod {@link #SEND_METHOD}, {@link #SEND_METHOD_SMART}, {@link
     *                   #SEND_METHOD_GEOFENCE}
     */
    public void setSendMethod(String sendMethod) {

        this.sendMethod = sendMethod;
    }

    /**
     * {@link #httpMethod} getter.
     *
     * @return ex> GET, POST...
     */
    public String getHttpMethod() {

        return httpMethod;
    }

    /**
     * {@link #httpMethod} setter.
     *
     * @param httpMethod ex> GET, POST...
     */
    public void setHttpMethod(String httpMethod) {

        this.httpMethod = httpMethod;
    }

    /**
     * {@link #authorization1} getter.
     *
     * @return 사용자 authorization key
     */
    public String getAuthorization1() {

        return authorization1;
    }

    /**
     * {@link #authorization1} setter.
     *
     * @param authorization1 사용자 authorization key
     */
    public void setAuthorization1(String authorization1) {

        this.authorization1 = authorization1;
    }

    /**
     * {@link #authorization2} getter.
     *
     * @return 사용자 authorization key
     */
    public String getAuthorization2() {

        return authorization2;
    }

    /**
     * {@link #authorization2} setter.
     *
     * @param authorization2 사용자 authorization key
     */
    public void setAuthorization2(String authorization2) {

        this.authorization2 = authorization2;
    }

    /**
     * {@link #authorization} getter.
     *
     * @return 사용자 authorization key
     */
    public String getAuthorization() {

        return authorization;
    }

    /**
     * {@link #authorization} setter.
     *
     * @param authorization 사용자 authorization key
     */
    public void setAuthorization(String authorization) {

        this.authorization = authorization;
    }

    /**
     * {@link #uriStr} getter.
     *
     * @return Rquest uri
     */
    public String getUriStr() {

        return uriStr;
    }

    /**
     * {@link #uriStr} setter.
     *
     * @param uriStr Request uri
     */
    public void setUriStr(String uriStr) {

        this.uriStr = uriStr;
    }

    /**
     * {@link #alfilePath} getter.
     *
     * @return 업로드할 file path list
     */
    public ArrayList<String> getAlFilePath() {

        return alfilePath;
    }

    /**
     * {@link #alfilePath} setter.
     *
     * @param alfilePath 업로드할 file path list
     */
    public void setAlFilePath(ArrayList<String> alfilePath) {

        this.alfilePath = alfilePath;
    }

    /**
     * {@link #fileParamName} getter.
     *
     * @return 업로드할 file name
     */
    public String getFileParamName() {

        return fileParamName;
    }

    /**
     * {@link #fileParamName} setter.
     *
     * @param fileParamName 업로드할 file name
     */
    public void setFileParamName(String fileParamName) {

        this.fileParamName = fileParamName;
    }

    /**
     * {@link #filePath} getter.
     *
     * @return 업로드할 file path
     */
    public String getFilePath() {

        return filePath;
    }

    /**
     * {@link #filePath} setter.
     *
     * @param filePath 업로드할 file path
     */
    public void setFilePath(String filePath) {

        this.filePath = filePath;
    }

    /**
     * {@link #alBody} getter.
     *
     * @return Parameter list using request body
     */
    public ArrayList<HashMap<String, Object>> getBody() {

        return alBody;
    }

    /**
     * {@link #alBody} setter.
     *
     * @param alBody Parameter list using request body
     */
    public void setBody(ArrayList<HashMap<String, Object>> alBody) {

        this.alBody = alBody;
    }

    /**
     * {@link #body} getter.
     *
     * @return Request body string
     */
    public String getBodyStr() {

        return body;
    }

    /**
     * {@link #body} setter.
     *
     * @param body Request body string
     */
    public void setBodyStr(String body) {

        this.body = body;
    }
}
