package com.jsowell.netty.handler;

import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 遥控地锁升锁与降锁命令
 *
 * 服务器下发命令给地锁，地锁执行动作
 *
 * @author JS-ZZA
 * @date 2022/9/19 15:41
 */
@Slf4j
@Component
public class RemoteControlGroundLockHandler extends AbstractHandler{
    private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_CONTROL_GROUND_LOCK_LIFTING_CODE.getBytes());

    @Override
    public void afterPropertiesSet() throws Exception {
        YKCOperateFactory.register(type, this);
    }

    @Override
    public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
        log.info("[===遥控地锁升锁与降锁命令===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
        // 下发
        // 桩编码

        // 枪号

        // 升/降地锁

        // 预留位

        // return super.supplyProcess(ykcDataTemplate, channel);
        return null;
    }
}
