package com.its.web.controller.notice;

import com.its.web.dto.notice.AttachFileDto;
import com.its.web.service.notice.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/notice")
@Api(tags = "04.공지사항")
public class NoticeController {

    private final NoticeService service;

    @ApiOperation(value = "01.첨부파일 다운로드")
    @PostMapping(value = "/attach", produces = {"application/json; charset=utf8"})
    @ResponseBody
    public AttachFileDto getAttachFile(@Param("boardNo") String boardNo,
                                       @Param("fileId") String fileId,
                                       @Param("fileName") String fileName) {
        return this.service.getAttachFile(boardNo, fileId, fileName);
    }
}
