package cn.sikey.hmd.api;

import cn.sikey.framework.common.pojo.CommonResult;
import cn.sikey.hmd.api.hmd.PlansApi;
import cn.sikey.hmd.api.hmd.vo.plans.PlansRespVO;
import cn.sikey.hmd.service.plans.PlansService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

/**
 * 套餐 API 接口实现类
 *
 * @author qin
 */
@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class PlansApiImpl implements PlansApi {

    @Resource
    private PlansService plansService;

    @Override
    public CommonResult<PlansRespVO> queryPlansDO(int validity) {
        return CommonResult.success(plansService.queryPlans(validity));
    }

    @Override
    public CommonResult<PlansRespVO> queryPlansDOById(Long id) {
        return CommonResult.success(plansService.queryPlansById(id));
    }
}
