package org.security.desk.feign;

import org.security.common.constant.CommonConstant;
import org.security.desk.vo.FaceVO;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.support.AbstractFormWriter;
import org.springframework.cloud.openfeign.support.JsonFormWriter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = CommonConstant.APPLICATION_DESK_NAME, configuration = IFaceClient.MultipartSupportConfig.class)
public interface IFaceClient {
	@Configuration
	class MultipartSupportConfig {
		@Bean
		public AbstractFormWriter jsonFormWriter() {
			return new JsonFormWriter();
		}
	}
	@PostMapping(value = "/face/register", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
	R<FaceVO> faceRegister(@RequestPart("faceVo") FaceVO faceVO, @RequestPart("file") MultipartFile file);

	@PostMapping(value = "/face/match", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
	R<FaceVO> faceMatch(@RequestPart("file") MultipartFile file);
}
