import api from "@shared/api"

interface IUseDeleteFileParams {
	onSuccess?: () => void
	onError?: (error: unknown) => void
}

export const useDeleteUserFile = ({
	onSuccess,
	onError,
}: IUseDeleteFileParams = {}) => {
	return api.useMutation("delete", "/api/files/files/{file_id}/", {
		onSuccess: () => {
			onSuccess?.()
		},
		onError: (error) => {
			onError?.(error)
		},
	})
}

export const useDeleteArtifact = ({
	onSuccess,
	onError,
}: IUseDeleteFileParams = {}) => {
	return api.useMutation("delete", "/api/media/artifacts/{artifact_id}/", {
		onSuccess: () => {
			onSuccess?.()
		},
		onError: (error) => {
			onError?.(error)
		},
	})
}

export const useDeleteMediaFile = ({
	onSuccess,
	onError,
}: IUseDeleteFileParams = {}) => {
	return api.useMutation("delete", "/api/media/mediafiles/{media_file_id}/", {
		onSuccess: () => {
			onSuccess?.()
		},
		onError: (error) => {
			onError?.(error)
		},
	})
}
