package com.arms.api.admin.schedule.controller;

import com.arms.api.admin.schedule.service.BackupScheduleService;
import com.arms.api.util.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.arms.api.util.response.CommonResponse.success;

@RequestMapping("/engine/admin/schedule")
@RequiredArgsConstructor
@RestController
public class BackupScheduleController {

    private final BackupScheduleService backupScheduleService;


    @PostMapping("/index/backup")
    public ResponseEntity<CommonResponse.ApiResult<String>> indexBackup() {
        backupScheduleService.indexBackup();
        return ResponseEntity.ok(success("Issue 인덱스 백업 작업이 시작되었습니다."));
    }

}