package com.sonic.pigeon.controller.web;

import com.sonic.common.auth.domains.Session;
import com.sonic.common.rpc.Result;
import com.sonic.pigeon.domain.output.ImUserAccountOutput;
import com.sonic.pigeon.service.ImUserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RestController;

/**
 * IM用户账号
 * @author coder
 */
@Validated
@RestController
public class ImUserWeb {

    @Autowired
    private ImUserService imUserService;

    @ApiOperation(value = "获取账号登录信息信息", tags = {"Web-IM用户账号"})
    @PostMapping("/web/im-user/get-account")
    public Result<ImUserAccountOutput> getAccountInfo(@ApiParam(hidden = true) Session session) {
        return Result.success(imUserService.getImUserAccount(session.getUserId()));
    }

}
