package com.ruoyi.api.controller.protocol;


import com.ruoyi.base.protocol.domain.vo.ProtocolVo;
import com.ruoyi.base.protocol.service.IProtocolService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.FilePathSplicingType;
import com.ruoyi.common.filepathsplicing.FilePathSplicing;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * API协议管理Controller
 *
 * @author xiechao
 * @date 2023-12-21
 */
@Validated
@Api(value = "API协议管理控制器", tags = {"API协议管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/protocol")
public class ApiProtocolController {

    private final IProtocolService iProtocolService;

    /**
     * 根据协议code查询 协议信息
     */
    @FilePathSplicing(type = FilePathSplicingType.RESPONSE)
    @ApiOperation("根据协议code查询 协议信息")
    @GetMapping("/info")
    public R<ProtocolVo> getInfo(@RequestParam("code") String code) {
        return R.ok(iProtocolService.getByProtocolCode(code));
    }

}
