package com.union.ai.api.controller.face;

import com.union.ai.api.dto.CopyParamDto;
import com.union.ai.api.dto.GetParamDto;
import com.union.ai.api.dto.UserDeleteDto;
import com.union.ai.api.dto.UserListParamDto;
import com.union.ai.api.util.Config;
import com.union.ai.api.util.HttpClientUtil;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2019/3/30
 * Time: 下午5:15
 */
@RestController
@RequestMapping(value = "/face-api/v3/user", method = RequestMethod.POST)
public class FaceUserController {

    /**
     * 复制用户
     * @param paramDto
     * @return
     */
    @RequestMapping("copy")
    public String copy(@RequestBody  CopyParamDto paramDto) {

        String url = Config.getInstance().getFaceUserUrl() + "copy";
        return HttpClientUtil.sendPostJSON(url, paramDto);

    }

    /**
     * 获取用户信息
     * @param paramDto
     * @return
     */
    @RequestMapping("get")
    public String get(@RequestBody  GetParamDto paramDto) {

        String url = Config.getInstance().getFaceUserUrl() + "get";
        return HttpClientUtil.sendPostJSON(url, paramDto);

    }

    /**
     * 用户列表
     * @param paramDto
     * @return
     */
    @RequestMapping("list")
    public String list(@RequestBody  UserListParamDto paramDto) {

        String url = Config.getInstance().getFaceUserUrl() + "list";
        return HttpClientUtil.sendPostJSON(url, paramDto);
    }

    /**
     * 用户删除
     * @param paramDto
     * @return
     */
    @RequestMapping("delete")
    public String delete(@RequestBody UserDeleteDto paramDto) {

        String url = Config.getInstance().getFaceUserUrl() + "delete";
        return HttpClientUtil.sendPostJSON(url, paramDto);
    }
}
