package com.skr.mdm.api.cmd;

import com.skr.mdm.bean.bo.CmdInfoBO;
import com.skr.mdm.bean.bo.InstructMessageBO;
import com.skr.mdm.bean.qo.cmd.CmdQO;
import com.skr.mdm.dto.LoginAdminDTO;
import com.skr.mdm.enums.CmdAdminEnum;
import com.skr.mdm.result.ResponseResult;
import com.skr.mdm.util.MdmIdUtil;

public interface CmdAdminProcessHandler {

    default InstructMessageBO getInstructMessageBO(CmdInfoBO cmdInfoBO, LoginAdminDTO loginAdminDTO) {
        Long msgId = MdmIdUtil.getSnowflakeNextId();
        CmdAdminEnum cmdAdminEnum = CmdAdminEnum.getValue(cmdInfoBO.getCmdType());
        Integer cmdType = cmdAdminEnum.getCmdValue();
        return InstructMessageBO.builder()
                .deviceIdList(cmdInfoBO.getEquipmentIdList())
                .msg(cmdInfoBO.getMsg())
                .messageId(msgId)
                .cmdType(cmdType)
                .isGlobal(0)
                .companyId(loginAdminDTO.getCompanyId())
                .build();
    }

    Long saveCmd(CmdInfoBO cmdInfoBO, LoginAdminDTO loginAdminDTO);

    ResponseResult cmdUserInfo(CmdQO cmdQO);

}
