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

import com.union.ai.api.dto.*;
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/group", method = RequestMethod.POST)
public class FaceUserGroupController {

    /**
     * 创建用户组
     * @param paramDto
     * @return
     */
    @RequestMapping("add")
    public String add(@RequestBody  GroupAddParamDto paramDto) {

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

    }

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

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

    }

    /**
     * 组列表
     * @param paramDto
     * @return
     */
    @RequestMapping("list")
    public String list(@RequestBody  GroupListParamDto paramDto) {

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

    }
}
