package org.raddatz.familienarchiv.document.transcription;

import lombok.RequiredArgsConstructor;
import org.raddatz.familienarchiv.document.transcription.TranscriptionQueueItemDTO;
import org.raddatz.familienarchiv.document.transcription.TranscriptionWeeklyStatsDTO;
import org.raddatz.familienarchiv.security.Permission;
import org.raddatz.familienarchiv.security.RequirePermission;
import org.raddatz.familienarchiv.document.transcription.TranscriptionQueueService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Serves the three Mission Control Strip columns for the dashboard.
 * All endpoints require READ_ALL — same guard as the rest of the archive.
 */
@RestController
@RequestMapping("/api/transcription")
@RequiredArgsConstructor
@RequirePermission(Permission.READ_ALL)
public class TranscriptionQueueController {

    private final TranscriptionQueueService transcriptionQueueService;

    @GetMapping("/segmentation-queue")
    public ResponseEntity<List<TranscriptionQueueItemDTO>> getSegmentationQueue() {
        return ResponseEntity.ok(transcriptionQueueService.getSegmentationQueue());
    }

    @GetMapping("/transcription-queue")
    public ResponseEntity<List<TranscriptionQueueItemDTO>> getTranscriptionQueue() {
        return ResponseEntity.ok(transcriptionQueueService.getTranscriptionQueue());
    }

    @GetMapping("/ready-to-read")
    public ResponseEntity<List<TranscriptionQueueItemDTO>> getReadyToRead() {
        return ResponseEntity.ok(transcriptionQueueService.getReadyToReadQueue());
    }

    @GetMapping("/weekly-stats")
    public ResponseEntity<TranscriptionWeeklyStatsDTO> getWeeklyStats() {
        return ResponseEntity.ok(transcriptionQueueService.getWeeklyStats());
    }
}
