package com.jeequan.jeepay.mch.ctrl.alipay;

import com.jeequan.jeepay.bizcommons.manage.alipay.AlipayIotDeviceBindManage;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.mch.ctrl.CommonCtrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
* 支付宝Iot设备-店铺绑定ctrl
*
* @author zx
*
* @date 2023/03/13 15:26
*/
@RestController
@RequestMapping("/api/alipayIot")
public class AlipayIotDeviceBindController extends CommonCtrl {

    @Autowired private AlipayIotDeviceBindManage alipayIotDeviceBindManage;

    /** 绑定、解绑蚂蚁店铺  **/
    @PreAuthorize("hasAuthority('ENT_DEVICE_RUYI_BIND')")
    @PostMapping( "/bind/{deviceId}")
    public ApiRes bind(@PathVariable("deviceId") Long deviceId) {
        return alipayIotDeviceBindManage.bind(getCurrentMchNo(), deviceId, getValByteRequired("alipayBindState"), getValString("storeId"));
    }

}
