import request from '@/config/axios'

export interface ImageUploadRespVO {
  url: string
  name: string
  size: number
  type: string
}

export interface ImageDeleteReqVO {
  datePath: string
  filename: string
}

/**
 * 上传隐患图片
 */
export const uploadDangerImage = (file: File) => {
  const formData = new FormData()
  formData.append('file', file)
  
  return request.post<ImageUploadRespVO>({
    url: '/safe/danger-image/upload',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 删除隐患图片
 */
export const deleteDangerImage = (params: ImageDeleteReqVO) => {
  return request.delete<boolean>({
    url: `/safe/danger-image/${params.datePath}/${params.filename}`
  })
} 