package com.ningdatech.carapi.log.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ningdatech.carapi.log.manage.LogBackupManage;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 服务器系统日志备份
 *
 * @author CMM
 * @since 2023/01/06 16:38
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/open/api/log/backup")
@Api(value = "OpenApiLogBackupController", tags = "服务器系统日志备份")
@RequiredArgsConstructor
public class OpenApiLogBackupController {

    private final LogBackupManage logBackupManage;

    @GetMapping( "/download")
    @ApiOperation(value = "将服务器定时备份的系统日志通过接口返回")
    public ResponseEntity<byte[]> downloadFile(){
        return logBackupManage.downloadFile();
    }
}
