package com.jeequan.jeepay.pay.ctrl.device.speaker;

import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.interfaces.device.ISpeakerService;
import com.jeequan.jeepay.core.utils.SpringBeansUtil;
import com.jeequan.jeepay.pay.ctrl.ApiController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 * 音箱相关接口类型
 * @author crystal
 * @date 2023/12/28 11:23
 */
@RestController
@RequestMapping("/api/speaker")
public class SpeakerController extends ApiController {

    @RequestMapping(value = "/bind/status/{provider}")
    public JSONObject bindStatus(@PathVariable("provider") String provider){
        JSONObject params = getReqParamJSON();
        //获取音箱接口配置
        ISpeakerService speakerService = SpringBeansUtil.getBean(provider + "SpeakerService", ISpeakerService.class);
        return speakerService.bindQuery(params);
    }
    @RequestMapping(value = "/get/url/{provider}")
    public JSONObject getUrl(@PathVariable("provider") String provider){
        JSONObject reqData = getReqParamJSON();
        //获取音箱接口配置
        ISpeakerService speakerService = SpringBeansUtil.getBean(provider + "SpeakerService", ISpeakerService.class);
        return speakerService.getUrl(reqData);
    }
}
