package com.sckw.system.controller.forkliftapp;

import com.sckw.core.web.response.BaseResult;
import com.sckw.system.model.vo.res.SysArticlesResVo;
import com.sckw.system.service.KwsSysArticlesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 系统内容配置Controller
 * @author chenxiaofei
 * @date 2026-01-07
 */
@RestController
@RequestMapping("/sysArticles")
@Tag(name = "系统文章相关接口")
@RequiredArgsConstructor
public class SysArticlesController {


    private final KwsSysArticlesService kwsSysArticlesService;

    /**
     * 获取隐私协议
     * @return BaseResult
     */
    @GetMapping("/privacyPolicy")
    @Operation(summary = "获取隐私协议", description = "获取隐私协议内容")
    public BaseResult<SysArticlesResVo> getPrivacyPolicy() {

        return BaseResult.success(kwsSysArticlesService.getPrivacyPolicy("PRIVACY_POLICY"));
    }

    /**
     * 获取服务协议
     * @return BaseResult
     */
    @GetMapping("/serviceAgreement")
    @Operation(summary = "获取服务协议", description = "获取服务协议内容")
    public BaseResult<SysArticlesResVo> getServiceAgreement() {

        return BaseResult.success(kwsSysArticlesService.getServiceAgreement("REG_AGREEMENT"));
    }

    /**
     * 根据文章标识获取文章
     * @param articleKey 文章标识
     * @return BaseResult
     */
    @GetMapping("/getByKey")
    @Operation(summary = "根据标识获取文章", description = "根据文章标识获取文章内容")
    public BaseResult<SysArticlesResVo> getByArticleKey(@RequestParam String articleKey) {

        return BaseResult.success(kwsSysArticlesService.getByArticleKey(articleKey));
    }

}

