package com.artfess.rescue.uc.controller;

import com.artfess.base.annotation.ApiGroup;
import com.artfess.base.constants.ApiGroupConsts;
import com.artfess.base.model.CommonResult;
import com.artfess.rescue.uc.manager.RescueOrgManager;
import com.artfess.rescue.uc.vo.OrgInfoVO;
import com.artfess.rescue.uc.vo.OrganizeInfoVO;
import com.artfess.rescue.uc.vo.RoadSegmentLevelVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/uc/org/")
@Api(tags = "组织管理")
@ApiGroup(group = {ApiGroupConsts.GROUP_BIZ_RESCUE})
public class RescueOrgController {
    @Resource
    RescueOrgManager orgManager;

    @GetMapping("/orgTree")
    @ApiOperation("组织树")
    public CommonResult<?> orgTree() {
        List<OrgInfoVO> orgs = orgManager.orgTree();
        return CommonResult.success(orgs,"");
    }

    @GetMapping("/roadTree")
    @ApiOperation("组织路段树")
    public CommonResult<?> roadTree() {
        List<OrgInfoVO> orgs = orgManager.roadTree();
        return CommonResult.success(orgs,"");
    }

    @GetMapping("/into/roadTree")
    @ApiOperation("新版-组织路段树")
    public CommonResult<?> roadNode() {
        OrganizeInfoVO vos = orgManager.roadNode();
        return CommonResult.success(vos,"");
    }

    @GetMapping("/into/orgTree")
    @ApiOperation("新版-组织树")
    public CommonResult<?> orgNode() {
        OrganizeInfoVO vos = orgManager.orgNode();
        return CommonResult.success(vos,"");
    }

    @GetMapping("/teamTree")
    @ApiOperation("组织队伍树")
    public CommonResult<?> teamTree(@RequestParam(required = false,value = "type")String type) {
        RoadSegmentLevelVO vo = orgManager.teamTree(type);
        return CommonResult.success(vo,"");
    }

    @GetMapping("/countTeamTree")
    @ApiOperation("组织路段树-统计人员")
    public CommonResult<?> countRoadTree() {
        return CommonResult.success(orgManager.countRoadTree(),"");
    }
}
