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

package com.ntels.kneet.v3.common.http;

import android.os.Message;

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

/**
 * Value object holding all context necessary for making a request.
 *
 * @author s0pau
 */
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;

    public CustomRequest(String httpMethod, String uriStr, String authorization, String body, String sendMethod) {

        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;
    }

    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;
    }

    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;
    }

    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;
    }

    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;
    }

    public Boolean getDialog() {

        return bDialog;
    }

    public void setDialog(Boolean bDialog) {

        this.bDialog = bDialog;
    }

    public String getSendMethod() {

        return sendMethod;
    }

    public void setSendMethod(String sendMethod) {

        this.sendMethod = sendMethod;
    }

    public String getHttpMethod() {

        return httpMethod;
    }

    public void setHttpMethod(String httpMethod) {

        this.httpMethod = httpMethod;
    }

    public String getAuthorization1() {

        return authorization1;
    }

    public void setAuthorization1(String authorization1) {

        this.authorization1 = authorization1;
    }

    public String getAuthorization2() {

        return authorization2;
    }

    public void setAuthorization2(String authorization2) {

        this.authorization2 = authorization2;
    }

    public String getAuthorization() {

        return authorization;
    }

    public void setAuthorization(String authorization) {

        this.authorization = authorization;
    }

    public String getUriStr() {

        return uriStr;
    }

    public void setUriStr(String uriStr) {

        this.uriStr = uriStr;
    }

    public ArrayList<String> getAlFilePath() {

        return alfilePath;
    }

    public void setAlFilePath(ArrayList<String> alfilePath) {

        this.alfilePath = alfilePath;
    }

    public String getFileParamName() {

        return fileParamName;
    }

    public void setFileParamName(String fileParamName) {

        this.fileParamName = fileParamName;
    }

    public String getFilePath() {

        return filePath;
    }

    public void setFilePath(String filePath) {

        this.filePath = filePath;
    }

    public ArrayList<HashMap<String, Object>> getBody() {

        return alBody;
    }

    public void setBody(ArrayList<HashMap<String, Object>> alBody) {

        this.alBody = alBody;
    }

    public String getBodyStr() {

        return body;
    }

    public void setBodyStr(String body) {

        this.body = body;
    }
}
