package cn.ey.biz.module.system.api.code;

import cn.ey.biz.common.pojo.R;
import cn.ey.biz.module.system.api.code.dto.*;
import cn.ey.biz.module.system.service.code.*;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.ey.biz.module.system.enums.ApiConstants.VERSION;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口，给 Dubbo Consumer 调用
@Validated
public class CodeApiImpl implements CodeApi {

    @Resource
    private CodeCustomerService codeCustomerService;

    @Resource
    private CodeBlockingLevelService codeBlockingLevelService;

    @Resource
    private CodeProjectService codeProjectService;

    @Resource
    private CodeEpService codeEpService;

    @Resource
    private CodeOtherService codeOtherService;

    @Override
    public R<CodeCustomerDTO> getCodeCustomer() {
        return R.success(codeCustomerService.getCodeCustomer(null));
    }

    @Override
    public R<CodeBlockingLevelDTO> getCodeBlockingLevel() {
        return R.success(codeBlockingLevelService.getCodeBlockingLevel(null));
    }

    @Override
    public R<CodeEpDTO> getCodeEpLevel() {
        return R.success(codeEpService.getCodeEpLevel(null));
    }

    @Override
    public R<CodeOtherDTO> getCodeOther() {
        return R.success(codeOtherService.getCodeOther(null));
    }

    @Override
    public R<CodeProjectDTO> getCodeProject() {
        return R.success(codeProjectService.getCodeProject(null));
    }
}
