package org.springblade.third.videodevice.wvp.feign;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.third.videodevice.gb28181.entity.GbDevice;
import org.springblade.third.videodevice.gb28181.feign.IThirdGbDeviceClient;
import org.springblade.third.videodevice.wvp.service.WvpService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/feign/third/gbdevice")
@AllArgsConstructor
public class ThirdGbDeviceClient implements IThirdGbDeviceClient {

	private final WvpService wvpService;
	/**
	 * 同步国标设备状态
	 */
	@Override
	@PostMapping("/sync")
	public R<GbDevice> sync(@RequestParam String deviceId){
		return wvpService.sync(deviceId);
	}

	@Override
	@PostMapping("/play")
	public R<JSONObject> play(@RequestParam(value = "deviceId", required = true) String deviceId, @RequestParam(value = "channelId", required = true) String channelId) {
		return wvpService.play(deviceId, channelId);
	}

	@Override
	@PostMapping("/stop")
	public R<String> stop(@RequestParam(value = "deviceId", required = true) String deviceId, @RequestParam(value = "channelId", required = true) String channelId) {
		return wvpService.stop(deviceId, channelId);
	}
}
