package cd.casic.ci.api;



import cd.casic.ci.process.dto.req.group.GroupAddReq;
import cd.casic.ci.process.dto.req.group.GroupListReq;
import cd.casic.ci.process.dto.req.group.GroupUpdateReq;
import cd.casic.ci.process.dto.resp.group.GroupListResp;
import cd.casic.ci.process.process.dataObject.pipgroup.PipGroup;
import cd.casic.ci.process.process.service.group.GroupService;
import cd.casic.framework.commons.pojo.CommonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName GroupController
 * @Author hopeli
 * @Date 2025/5/10 10:57
 * @Version 1.0
 */

@RestController
@RequestMapping("/group")
public class GroupController {
    @Resource
    private GroupService groupService;
    @PostMapping("/addGroup")
    public CommonResult<Void> addGroup(@RequestBody GroupAddReq req){
        groupService.addGroup(req);
        return CommonResult.success();
    }
    @PostMapping("/editGroup")
    public CommonResult<Void> editGroup(@RequestBody GroupUpdateReq req){
        groupService.editGroup(req);
        return CommonResult.success();
    }
    @PostMapping("/listGroup")
    public CommonResult<List<GroupListResp>> listGroup(@RequestBody GroupListReq req){
        return CommonResult.success(groupService.listGroup(req));
    }
    @DeleteMapping("/deleteGroup/{id}")
    public CommonResult<Void> deleteGroup(@PathVariable String id){
        groupService.deleteGroup(id);
        return CommonResult.success();
    }
}
