package com.yuchen.saas.park.service.controller.accredit;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.accredit.ProjectAccreditReqDTO;
import com.yuchen.saas.park.api.vo.accredit.ProjectAccreditInfoVO;
import com.yuchen.saas.park.service.service.accredit.ISaasParkAccreditInfoService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 项目授权信息表接口
 *
 * @author zhouhanwei
 * @since 2024-10-31
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/parkAccredit")
public class SaasParkAccreditInfoController {

    private final ISaasParkAccreditInfoService baseService;

    /**
     * 项目授权
     */
    @PostMapping("/saveProjectAccredit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "项目授权")
    public R<Boolean> saveProjectAccredit(@RequestBody @Validated ProjectAccreditReqDTO reqDTO) {
        return R.data(baseService.saveProjectAccredit(reqDTO));
    }

    /**
     * 查看项目授权列表
     */
    @GetMapping("/getProjectAccreditList/{projectId}")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "查看项目授权列表")
    public R<List<ProjectAccreditInfoVO>> getProjectAccreditList(@PathVariable Long projectId) {
        return R.data(baseService.getProjectAccreditList(projectId));
    }

}
