import {
	HttpRequest,
	HttpFileUpload
} from './request';
import config from './config';
export const baseUrl = config.apiUrl;

export const calluser = (url, parmas = {}) => {
	return HttpRequest(baseUrl + "user/" + url, 'post', parmas);
}

export const login = (parmas = {}) => {
	return HttpRequest(baseUrl + "user/auth/loginByPwd", 'post', parmas);
}

export const getUserZone = (parmas = {}) => {
	return HttpRequest(baseUrl + "operate/ebikeRegion/getZone", 'get', parmas);
}

export const getUserOperation = (parmas = {}) => {
	return HttpRequest(baseUrl + "operate/ebikeRegion/getOperation", 'get', parmas);
}

export const getUserRegion = (parmas = {}) => {
	return HttpRequest(baseUrl + "operate/ebikeRegion/getRegion", 'get', parmas);
}

export const callEbikeInfo = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "maintenance/ebikeBikeInfo/" + url, method, parmas);
}

export const callCoreApi = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "maintenance/core/" + url, method, parmas);
}
 
export const fileUpload = (file) => {
	return HttpFileUpload(baseUrl + "maintenance/ebikeBikeInfo/fileUpload", file);
}
export const fileUploadUser = (file) => {
	return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUpload", file);
}
export const callEbikeBatteryApply = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "maintenance/ebikeBatteryApply/" + url, method, parmas);
}

export const callOperateApi = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "operate/" + url, method, parmas);
}

export const callOrdereApi = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "order/" + url, method, parmas);
}

export const callMaintenanceApi = (url, parmas = {}, method = 'post') => {
	return HttpRequest(baseUrl + "maintenance/" + url, method, parmas);
}

export const fileUploadApi = (url,file) => {
	return HttpFileUpload(baseUrl + url, file);
}