package com.easyproject.web.controller.coze;

import java.util.List;

import com.easyproject.service.domain.coze.CozeBotSet;
import com.easyproject.service.domain.coze.CozeWorkspacesSet;
import com.easyproject.system.service.coze.ICozeWorkspacesSetService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.easyproject.common.annotation.Log;
import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.common.enums.BusinessType;
import com.easyproject.common.core.page.TableDataInfo;

/**
 * 空间设置Controller
 *
 * @author easyproject
 * @date 2025-03-22
 */
@RestController
@RequestMapping("/system/workspacesSet")
public class CozeWorkspacesSetController extends BaseController {
    @Autowired
    private ICozeWorkspacesSetService cozeWorkspacesSetService;

    /**
     * 查询空间设置列表
     */
    @PreAuthorize("@ss.hasPermi('system:workspacesSet:list')")
    @GetMapping("/list")
    public AjaxResult list(CozeWorkspacesSet cozeWorkspacesSet) {
        return cozeWorkspacesSetService.selectCozeWorkspacesSetList(cozeWorkspacesSet);
    }


    /**
     * 查询智能体列表
     * id:空间ID
     */
    @PreAuthorize("@ss.hasPermi('system:workspacesSet:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String spaceId) {
        return cozeWorkspacesSetService.selectCozeWorkspacesSetById(spaceId);
    }


    /**
     * 修改空间设置(切换空间)
     */
    @PreAuthorize("@ss.hasPermi('system:workspacesSet:edit')")
    @Log(title = "空间设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CozeWorkspacesSet cozeWorkspacesSet) {
        return cozeWorkspacesSetService.updateCozeWorkspacesSet(cozeWorkspacesSet);
    }

    /**
     * 方法说明: 空间智能体设置
     * @param
     * @return
     * @author java-101
     * @date 2025-03-23 14:01:19
     */
    @PreAuthorize("@ss.hasPermi('system:workspacesSet:edit')")
    @Log(title = "空间智能体设置", businessType = BusinessType.UPDATE)
    @PostMapping("/setEnableBot")
    public AjaxResult updateStatus(@RequestBody CozeBotSet botSet) {
        return cozeWorkspacesSetService.updateStatus(botSet);
    }
}
