package com.yingpaipay.setting.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.yingpaipay.setting.domain.AiSetting;
import com.yingpaipay.setting.service.IAiSettingService;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/setting/ai")
public class AiSettingController extends BaseController {

    private final IAiSettingService aiSettingService;

    @SaCheckPermission("setting:ai:index")
    @GetMapping()
    public R<AiSetting> query() {
        return R.ok(aiSettingService.query());
    }

    @SaCheckPermission("setting:ai:edit")
    @PutMapping()
    public R<Void> edit(@RequestBody AiSetting request) {
        return toAjax(aiSettingService.edit(request));
    }

}
