package com.sz.admin.monitor.controller;

import com.sz.admin.monitor.service.FaceImageService;
import com.sz.core.common.entity.ApiResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * ClassName: FaceImageContoller
 * Package: com.sz.admin.monitor.controller
 * Description:
 */
@Tag(name =  "人脸图片表")
@RestController
@RequestMapping("ry-face-image")
@RequiredArgsConstructor
@Slf4j
public class FaceImageController {
    private final FaceImageService faceImageService;
    @Operation(summary = "人脸图片上传接口")
    @PostMapping("/upload")
    public ApiResult<String> fileUpload(@RequestBody MultipartFile file) {
      log.info("图片上传成功：{}", file.getOriginalFilename());
      return ApiResult.success(faceImageService.fileUpload(file));
    }
    @Operation(summary = "人脸图片上传绑定")
    @PostMapping("/upload/{id}")
    public ApiResult<Void> fileUploadBind(@RequestBody MultipartFile file, @PathVariable("id") Long id) {
        faceImageService.fileUploadBind(file, id);
        return ApiResult.success();
    }
}
