package cn.cslg.pas.controller;


import cn.cslg.pas.common.core.base.Constants;
import cn.cslg.pas.common.model.vo.SystemFieldVO;
import cn.cslg.pas.common.utils.Response;
import cn.cslg.pas.service.PatentFieldService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  系统字段 前端控制器
 * </p>
 *
 * @author 王岩
 * @since 2022-03-04
 */
@Tag(name = "专利系统字段")
@RestController
@RequestMapping(Constants.API_VERSION_V2 + "/patent/field")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class PatentFieldController {
    private final PatentFieldService patentFieldService;
    @GetMapping("list")
    @Operation(summary = "字段列表")
    public String getList(String type, Integer projectId) {
        return Response.success(patentFieldService.getUserFieldDataList(projectId, type));
    }
    @GetMapping("setting")
    @Operation(summary = "获取用户设置")
    public String getUserSetting(SystemFieldVO params) {
        return Response.success(patentFieldService.getUserSetting(params));
    }
    @PostMapping("setting")
    @Operation(summary = "更新用户设置")
    public String setUserSetting(@RequestBody SystemFieldVO params) {
        return Response.success(patentFieldService.setUserSetting(params));
    }
}

