package com.ruoyi.cai.controller.app;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.cai.domain.AgreementSetting;
import com.ruoyi.cai.dto.app.vo.AgreementDTO;
import com.ruoyi.cai.service.AgreementSettingService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 协议设置
 *
 * @author 77
 * @date 2024-01-14
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/agreementSetting")
@Tag(name = "协议相关接口")
public class AgreementSettingAppController extends BaseController {

    private final AgreementSettingService agreementSettingService;


    @GetMapping("/userAgreement")
    @Operation(summary = "获取用户协议")
    @Log(title = "获取用户协议", businessType = BusinessType.OTHER, isSaveDb = false)
    public R<AgreementDTO> userAgreement() {
        String userAgreement = agreementSettingService.getAgreementSetting().getUserAgreement();
        return R.ok(new AgreementDTO(userAgreement));
    }

    @GetMapping("/anchorJoinAgreement")
    @Operation(summary = "用户主播入驻协议")
    @Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
    public R<AgreementDTO> anchorJoinAgreement() {
        String anchorJoinAgreement = agreementSettingService.getAgreementSetting().getAnchorJoinAgreement();
        return R.ok(new AgreementDTO(anchorJoinAgreement));
    }



}
