package com.usky.sas.controller.web;

import com.usky.common.core.bean.ApiResult;
import com.usky.sas.domain.SasSystemConfig;
import com.usky.sas.service.SasSystemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统配置接口
 *
 * 对应 API 文档：
 * GET /prod-api/service-sas/system/config
 * PUT /prod-api/service-sas/system/config
 */
@RestController
@RequestMapping("/system")
public class SasSystemConfigController {

    @Autowired
    private SasSystemConfigService systesasConfigService;

    /**
     * 查询系统配置
     */
    @GetMapping("/config")
    public ApiResult<SasSystemConfig> getConfig() {
        return ApiResult.success(systesasConfigService.getConfig());
    }

    /**
     * 编辑系统配置
     */
    @PutMapping("/config")
    public ApiResult<Void> updateConfig(@RequestBody SasSystemConfig config) {
        systesasConfigService.updateConfig(config);
        return ApiResult.success();
    }
}

