package com.usky.ai.controller.web;

import com.usky.ai.dto.*;
import com.usky.ai.service.EdgeMediaService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/repositories")
@RequiredArgsConstructor
public class RepositoryController {

    private final EdgeMediaService service;

    @GetMapping
    public RepositoriesInfoResponseDTO listRepositories() {
        return service.listRepositories();
    }

    @PostMapping("/create")
    public RepositoryCreateResponseDTO createRepository(@RequestBody RepositoryCreateRequestDTO request) {
        return service.createRepository(request);
    }

    @PostMapping("/update")
    public RepositoryUpdateResponseDTO updateRepository(@RequestBody RepositoryUpdateRequestDTO request) {
        return service.updateRepository(request);
    }

    @DeleteMapping("/delete")
    public RepositoryDeleteResponseDTO deleteRepository(@RequestBody RepositoryDeleteRequestDTO request) {
        return service.deleteRepository(request);
    }

    @PostMapping("/faces")
    public RepositoryFacesResponseDTO getRepositoryFaces(@RequestBody RepositoryFacesRequestDTO request) {
        return service.getRepositoryFaces(request);
    }

    @PostMapping("/register")
    public RegisterFaceResponseDTO registerFace(@RequestBody RegisterFaceRequestDTO request) {
        return service.registerFace(request);
    }

    @PostMapping("/update-face")
    public UpdateFaceResponseDTO updateFace(@RequestBody UpdateFaceRequestDTO request) {
        return service.updateFace(request);
    }

    @DeleteMapping("/delete-face")
    public DeleteFaceResponseDTO deleteFace(@RequestBody DeleteFaceRequestDTO request) {
        return service.deleteFace(request);
    }

    @PostMapping("/recognize")
    public FaceRecognitionResponseDTO recognizeFace(@RequestBody FaceRecognitionRequestDTO request) {
        return service.recognizeFace(request);
    }
}