package com.reyun.saas.web.controller.user.datacentre;

import com.reyun.saas.common.framework.ApiRestController;
import com.reyun.saas.common.restResult.RestResult;
import com.reyun.saas.mob.user.service.MetaDataService;
import com.reyun.saas.security.utils.SecurityUtils;
import com.reyun.saas.web.aop.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.Map;

@Slf4j
@Api(value = "/metaData", tags = "元数据分析")
@ApiRestController("metaData")
public class MetaDataController {

    @Resource
    private MetaDataService metaDataService;


    @Log(value = 4, description = "查询设备状态", type = 7)
    @ApiOperation(value = "查询设备状态", notes = "部分设备id有特殊字符无法url传参 这里使用post请求体传参  appkey : appkey  设备id : equipmentId" , produces = "application/json")
    @PostMapping("equipmentStatus")
    public RestResult equipmentStatus(@RequestBody Map map){
       return metaDataService.equipmentStatus(map, SecurityUtils.getLoginUserId());
    }

    @Log(value = 4, description = "实时日志流", type = 7)
    @ApiOperation(value = "实时日志流", notes = "appkey : appkey  " , produces = "application/json")
    @GetMapping("logFlow")
    public RestResult logFlow(String appkey){
        return metaDataService.logFlow(appkey,SecurityUtils.getLoginUserId());
    }


}
