package com.sonic.pigeon.controller.api;

import com.sonic.common.rpc.Result;
import com.sonic.pigeon.lib.input.CreateImUserInput;
import com.sonic.pigeon.lib.input.EditImUserInput;
import com.sonic.pigeon.service.ImUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * API-IM用户处理
 * @author coder
 */
@Validated
@RestController
public class ImUserApi {

    @Autowired
    private ImUserService imUserService;

    @ApiOperation(value = "创建IM账号", tags = {"API-IM用户处理"})
    @PostMapping("/api/im-user/create")
    public Result<Void> createImUser(@RequestBody @Valid CreateImUserInput input) {
        imUserService.createImUser(input);
        return Result.success();
    }

    @ApiOperation(value = "修改IM用户基础信息", tags = {"API-IM用户处理"})
    @PostMapping("/api/im-user/edit")
    public Result<Void> editImUser(@RequestBody @Valid EditImUserInput input) {
        imUserService.editImUser(input);
        return Result.success();
    }

}
