package com.hz.pm.api.external.controller;

import com.hz.pm.api.external.MhFileClient;
import com.hz.pm.api.external.model.dto.MhFileInfoDTO;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * MhFileController
 * </p>
 *
 * @author WendyYang
 * @since 09:47 2023/12/29
 */
@Api("信创平台文件管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/mh/file")
public class MhFileController {

    private final MhFileClient mhFileClient;

    @GetMapping("/download/{fileId}")
    @WebLog("下载信创平台文件")
    @ApiOperation("下载信创平台文件")
    public void download(@PathVariable String fileId, HttpServletResponse response) {
        mhFileClient.download(fileId, response);
    }

    @GetMapping("/listFileInfo")
    @ApiOperation("获取文件详情")
    public List<MhFileInfoDTO> listFileInfo(@RequestParam String fileIds) {
        return mhFileClient.listFileInfo(fileIds);
    }

}
