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

import com.thinkunion.park.service.common.constant.GroupAction;
import com.yuchen.saas.park.api.dto.park.SystemTagReqDTO;
import com.yuchen.saas.park.api.dto.park.SystemTagSubmitReqDTO;
import com.yuchen.saas.park.api.vo.park.SystemTagVO;
import com.yuchen.saas.park.service.service.IPmgBatParkSystemTagService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 系统标签表接口
 *
 * @author zhouhanwei
 * @since 2024-11-12
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/systemTag")
public class PmgBatParkSystemTagController {

    private final IPmgBatParkSystemTagService baseService;

    /**
     * 系统标签分页列表
     */
    @PostMapping("/findSystemTagPage")
    @ApiOperation(value = "系统标签分页列表", notes = "系统标签分页列表")
    public R<NestPage<SystemTagVO>> findSystemTagPage(@RequestBody SystemTagReqDTO reqDTO) {
        return R.data(baseService.findSystemTagPage(reqDTO));
    }

    /**
     * 系统标签详情
     */
    @GetMapping("/getSystemTagById/{systemTagId}")
    @ApiOperation(value = "系统标签详情", notes = "系统标签详情")
    public R<SystemTagVO> getSystemTagById(@PathVariable Long systemTagId) {
        return R.data(baseService.getSystemTagById(systemTagId));
    }

    /**
     * 添加系统标签
     */
    @PostMapping("/addSystemTag")
    @ApiOperation(value = "添加系统标签", notes = "添加系统标签")
    public R addSystemTag(@Validated(GroupAction.InsertAction.class) @RequestBody SystemTagSubmitReqDTO reqDTO) {
        return R.status(baseService.addSystemTag(reqDTO));
    }

    /**
     * 编辑系统标签
     */
    @PostMapping("/editSystemTag")
    @ApiOperation(value = "编辑系统标签", notes = "编辑系统标签")
    public R editSystemTag(@Validated(GroupAction.UpdateAction.class) @RequestBody SystemTagSubmitReqDTO reqDTO) {
        return R.status(baseService.editSystemTag(reqDTO));
    }

    /**
     * 删除系统标签
     */
    @PostMapping("/removeSystemTag/{systemTagId}")
    @ApiOperation(value = "删除系统标签", notes = "删除系统标签")
    public R removeSystemTag(@PathVariable Long systemTagId) {
        return R.status(baseService.removeSystemTag(systemTagId));
    }
}

