package ink.wgink.common.rpc.rest.pojo;

import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMethod;

import java.io.File;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: RemoteRequest
 * @Description: 远程请求
 * @Author: wanggeng
 * @Date: 2022/8/4 14:43
 * @Version: 1.0
 */
public class RemoteRequest {

    private RequestMethod requestMethod;
    private String remoteUri;
    private Map<String, String> headers;
    private MultiValueMap<String, Object> formVariableParams;
    private Object jsonBody;
    private Map<String, File> fileVariableParams;
    private Map<String, RemoteFileInputStream> fileInputStreamVariableParams;
    private Type resultType;

    public RequestMethod getRequestMethod() {
        return requestMethod;
    }

    public void setRequestMethod(RequestMethod requestMethod) {
        this.requestMethod = requestMethod;
    }

    public String getRemoteUri() {
        return remoteUri == null ? "" : remoteUri.trim();
    }

    public void setRemoteUri(String remoteUri) {
        this.remoteUri = remoteUri;
    }

    public Map<String, String> getHeaders() {
        return headers == null ? new HashMap<>() : headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public MultiValueMap<String, Object> getFormVariableParams() {
        return formVariableParams == null ? new LinkedMultiValueMap<>() : formVariableParams;
    }

    public void setFormVariableParams(MultiValueMap<String, Object> formVariableParams) {
        this.formVariableParams = formVariableParams;
    }

    public Object getJsonBody() {
        return jsonBody;
    }

    public void setJsonBody(Object jsonBody) {
        this.jsonBody = jsonBody;
    }

    public Map<String, File> getFileVariableParams() {
        return fileVariableParams == null ? new HashMap<>() : fileVariableParams;
    }

    public void setFileVariableParams(Map<String, File> fileVariableParams) {
        this.fileVariableParams = fileVariableParams;
    }

    public Map<String, RemoteFileInputStream> getFileInputStreamVariableParams() {
        return fileInputStreamVariableParams;
    }

    public void setFileInputStreamVariableParams(Map<String, RemoteFileInputStream> fileInputStreamVariableParams) {
        this.fileInputStreamVariableParams = fileInputStreamVariableParams;
    }

    public Type getResultType() {
        return resultType;
    }

    public void setResultType(Type resultType) {
        this.resultType = resultType;
    }

}
