import { AccountBindDeviceVO } from "../../../vo/account/AccountBindDeviceVO";
import { BindDeviceAction } from "./BindDeviceAction";
import { MsgClientType } from "./MsgClientType";
import { MsgType } from "./MsgType";
import { YMSMessage } from "./YMSMessage";

export class AccountBindDeviceMessage extends YMSMessage {
    accountBindDevice: AccountBindDeviceVO;
    bindDeviceAction: BindDeviceAction;

    constructor() {
        super(MsgClientType.SERVER, MsgClientType.ANY, MsgType.BIND_DEVICE);
        this.accountBindDevice = new AccountBindDeviceVO();
        this.bindDeviceAction = BindDeviceAction.BIND;
    }

    public getQoS(): number {
        return 1;
    }

    public isRetained(): boolean {
        return false;
    }

    toString(): string {
        return `AccountBindDeviceMessage{` +
          `timestamp=${this.timestamp}, ` +
          `sender=${MsgClientType[this.sender]}, ` +
          `receiver='${MsgClientType[this.receiver]}, ` +
          `msgType=${MsgType[this.msgType]}, ` +
          `senderClientId='${this.senderClientId}', ` +
          `accountBindDevice=${this.accountBindDevice.toString()}, ` +
          `bindDeviceAction=${BindDeviceAction[this.bindDeviceAction]}` +
          `}`;
    }

}