package cn.iocoder.yudao.module.configure.api.uniTemplate;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.configure.api.uniTemplate.dto.UniTemplateCreateDTO;
import cn.iocoder.yudao.module.configure.api.uniTemplate.dto.UniTemplateDTO;
import cn.iocoder.yudao.module.configure.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.security.PermitAll;
import javax.validation.Valid;


@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Api(tags = "RPC 服务 - 小程序模板")
@Validated
public interface UniTemplateApi {
    String PREFIX = ApiConstants.PREFIX + "/trace-cert";

    @PostMapping(PREFIX + "/createUniTemplate")
    @ApiOperation("创建小程序模板")
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<Long> createUniTemplate(@Valid @RequestBody UniTemplateCreateDTO createReqVO) ;

    @PostMapping(PREFIX + "/delUniTemplate")
    @ApiOperation("删除小程序模板")
    @ApiImplicitParam(name = "uniTemplateId", value = "小程序模板ID", required = true, example = "1", dataTypeClass = Long.class)
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<Boolean> delUniTemplate(Long uniTemplateId) ;

    @PostMapping(PREFIX + "/getTemplateById")
    @PermitAll // 无需登陆
    @ApiOperation("根据ID获取小程序模板")
    @ApiImplicitParam(name = "id", value = "模板ID", required = true, example = "1", dataTypeClass = Long.class)
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<UniTemplateDTO> getTemplateById(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/getDefaultTemplate")
    @PermitAll // 无需登陆
    @ApiOperation("获取默认小程序模板")
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<UniTemplateDTO> getDefaultTemplate();

}
