/** @format */

import web from "@/utils/axios/web.ts";

/**
 * 获取用户存储商
 * @param data 用户id
 */
export const getAllStorage = (data: any) => {
	return web.request({
		url: "/oss/oss/user/selectUserOSSType",
		method: "get",
		params: {
			userId: data,
		},
	});
};

/**
 * 获取存储商所有存储桶
 * @param data 用户id
 * @param type
 */
export const getStorageBuckets = (data: any, type: any) => {
	return web.request({
		url: "/oss/oss/" + type + "/seleteBucket",
		method: "post",
		params: {
			userId: data,
		},
	});
};
/**
 * 获取存储桶所有文件
 * @param userId
 * @param type
 * @param bucket
 * @param dirName
 */
export const getBucketFiles = (userId: any, bucket: any, dirName: any, type: any) => {
	return web.request({
		url: "/oss/oss/" + type + "/listDir",
		method: "get",
		params: {
			userId: userId,
			bucket: bucket,
			dirName: dirName,
		},
	});
};
/**
 * 获取存储商所有存储桶个数
 * @param userId
 */
export const getStorageAndBuckets = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectUserOSSType",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户文件热力图
 * @param userId
 */
export const getUserFileHeatMap = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectUserFileHeat",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户文件流量
 * @param userId
 */
export const getUserFileFlow = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectFileFlow",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户文件个数
 * @param userId
 */
export const getUserFileCount = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectFileCount",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户每月上传文件个数
 * @param userId
 */
export const getUserUploadFileDiagramPerMonth = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectUploadFileDiagramPerMonth",
		method: "get",
		params: {
			userId: userId,
		},
	});
};

/**
 * 获取用户每月下载文件个数
 * @param userId
 */
export const getUserDownloadFileDiagramPerMonth = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectDownloadFileDiagramPerMonth",
		method: "get",
		params: {
			userId: userId,
		},
	});
};

/**
 * 获取用户最近下载文件
 * @param userId
 */
export const getUserRecentDownloadFile = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectRecentDownloadFile",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户最近上传文件
 * @param userId
 */
export const getUserRecentUploadFile = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectRecentUploadFile",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
/**
 * 获取用户最近预览文件
 * @param userId
 */
export const getUserRecentPreviewFile = (userId: any) => {
	return web.request({
		url: "/oss/oss/user/selectPreviewFile",
		method: "get",
		params: {
			userId: userId,
		},
	});
};
