package com.ruoyi.api;

import com.ruoyi.ai.domain.AiCustomerService;
import com.ruoyi.ai.service.IAiCustomerServiceService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.RandomStringUtil;
import com.ruoyi.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 javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 客服管理Controller
 * 
 * @author shi
 * @date 2025-11-13
 */
@RestController
@RequestMapping("/api/service")
public class AiCustomerServiceApiController extends BaseController
{
    @Autowired
    private IAiCustomerServiceService aiCustomerServiceService;

    /**
     * 查询客服管理列表
     */
    @GetMapping("/list")
    public AjaxResult list()
    {
        AiCustomerService aiCustomerService = new AiCustomerService();
        aiCustomerService.setStatus(0);
        List<AiCustomerService> list = aiCustomerServiceService.selectAiCustomerServiceList(aiCustomerService);
        if (list != null && list.size() > 0) {
            AiCustomerService service = list.get(RandomStringUtil.getRandomNumberWithin(list.size()));
            return AjaxResult.success().put("result", service);
        }
        return AjaxResult.error("No customer service available at the moment");
    }


}
