package com.fs.company.controller.aiSipCall;

import com.fs.aiSipCall.domain.AiSipCallBizGroup;
import com.fs.aiSipCall.service.IAiSipCallBizGroupService;
import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * aiSIP外呼技能组Controller
 * 
 * @author fs
 * @date 2026-03-06
 */
@RestController
@RequestMapping("/company/aiSipCall/bizGroup")
public class AiSipCallBizGroupController extends BaseController
{
    @Autowired
    private IAiSipCallBizGroupService aiSipCallBizGroupService;

    /**
     * 查询aiSIP外呼技能组列表
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:list')")
    @GetMapping("/list")
    public TableDataInfo list(AiSipCallBizGroup aiSipCallBizGroup)
    {
        startPage();
        List<AiSipCallBizGroup> list = aiSipCallBizGroupService.selectAiSipCallBizGroupList(aiSipCallBizGroup);
        return getDataTable(list);
    }

    /**
     * 导出aiSIP外呼技能组列表
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:export')")
    @Log(title = "aiSIP外呼技能组", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AiSipCallBizGroup aiSipCallBizGroup)
    {
        List<AiSipCallBizGroup> list = aiSipCallBizGroupService.selectAiSipCallBizGroupList(aiSipCallBizGroup);
        ExcelUtil<AiSipCallBizGroup> util = new ExcelUtil<>(AiSipCallBizGroup.class);
        return util.exportExcel(list, "aiSIP外呼技能组数据");
    }

    /**
     * 获取aiSIP外呼技能组详细信息
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:query')")
    @GetMapping(value = "/{groupId}")
    public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
    {
        return AjaxResult.success(aiSipCallBizGroupService.selectAiSipCallBizGroupByGroupId(groupId));
    }

    /**
     * 新增aiSIP外呼技能组
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:add')")
    @Log(title = "aiSIP外呼技能组", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AiSipCallBizGroup aiSipCallBizGroup)
    {
        return toAjax(aiSipCallBizGroupService.insertAiSipCallBizGroup(aiSipCallBizGroup));
    }

    /**
     * 修改aiSIP外呼技能组
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:edit')")
    @Log(title = "aiSIP外呼技能组", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AiSipCallBizGroup aiSipCallBizGroup)
    {
        return toAjax(aiSipCallBizGroupService.updateAiSipCallBizGroup(aiSipCallBizGroup));
    }

    /**
     * 删除aiSIP外呼技能组
     */
    @PreAuthorize("@ss.hasPermi('company:aiSipCall:bizGroup:remove')")
    @Log(title = "aiSIP外呼技能组", businessType = BusinessType.DELETE)
	@DeleteMapping("/{groupIds}")
    public AjaxResult remove(@PathVariable Long[] groupIds)
    {
        return toAjax(aiSipCallBizGroupService.deleteAiSipCallBizGroupByGroupIds(groupIds));
    }
}
