package com.hotwj.platform.system.maintenance.controller;

import com.hotwj.platform.system.maintenance.domain.bo.MediaResourceMetadataRepairRequest;
import com.hotwj.platform.system.maintenance.domain.vo.MediaResourceMetadataRepairSubmitVo;
import com.hotwj.platform.system.maintenance.domain.vo.MediaResourceMetadataRepairTaskStatusVo;
import com.hotwj.platform.system.maintenance.service.IMediaResourceMetadataRepairService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.springframework.web.bind.annotation.*;

/**
 * 系统维护-媒体资源元数据修复
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/maintenance/media-resource")
public class MediaResourceMaintenanceController extends BaseController {

    private final IMediaResourceMetadataRepairService mediaResourceMetadataRepairService;

    @PostMapping("/repair-metadata")
    public R<MediaResourceMetadataRepairSubmitVo> repairMetadata(@Valid @RequestBody MediaResourceMetadataRepairRequest request) {
        return R.ok(mediaResourceMetadataRepairService.submitRepairTask(request));
    }

    @GetMapping("/repair-metadata/{taskId}")
    public R<MediaResourceMetadataRepairTaskStatusVo> getTaskStatus(@PathVariable String taskId) {
        return R.ok(mediaResourceMetadataRepairService.getTaskStatus(taskId));
    }
}
