package cn.com.tenlion.projectconfig.controller.app.api.projectconfig;

import cn.com.tenlion.projectconfig.util.ProjectConfigUtil;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import cn.com.tenlion.projectconfig.pojo.dtos.projectconfig.ProjectConfigDTO;
import cn.com.tenlion.projectconfig.pojo.vos.projectconfig.ProjectConfigVO;
import cn.com.tenlion.projectconfig.service.projectconfig.IProjectConfigService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: ProjectConfigAppController
 * @Description: CBC项目配置管理表
 * @Author: CodeFactory
 * @Date: 2021-08-12 13:54:56
 * @Version: 3.0
 **/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "CBC项目配置管理表接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/projectconfig" + ISystemConstant.RELEASE_SUFFIX)
public class ProjectConfigAppController extends DefaultBaseController {

    @ApiOperation(value = "获取文件配置", notes = "获取文件配置接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("file/{key}")
    public SuccessResultData<String> getFile(@PathVariable("key") String key) {
        return new SuccessResultData<String>(ProjectConfigUtil.getFile(key));
    }

    @ApiOperation(value = "获取整数配置", notes = "获取整数配置接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("number/{key}")
    public SuccessResultData<Integer> getInteger(@PathVariable("key") String key) {
        return new SuccessResultData<Integer>(ProjectConfigUtil.getInt(key));
    }

    @ApiOperation(value = "获取小数配置", notes = "获取小数配置接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("double/{key}")
    public SuccessResultData<Double> getDouble(@PathVariable("key") String key) {
        return new SuccessResultData<Double>(ProjectConfigUtil.getDouble(key));
    }

    @ApiOperation(value = "获取开关配置", notes = "获取开关配置接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("switch/{key}")
    public SuccessResultData<Boolean> getSwitch(@PathVariable("key") String key) {
        return new SuccessResultData<Boolean>(ProjectConfigUtil.getSwitch(key));
    }

    @ApiOperation(value = "获取文字配置", notes = "获取文字配置接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("text/{key}")
    public SuccessResultData<String> getText(@PathVariable("key") String key) {
        return new SuccessResultData<String>(ProjectConfigUtil.getText(key));
    }


}