import { MsgReqSend } from '../../../Shared/protocols/MsgReqSend';
import { MsgResSend } from '../../../Shared/protocols/MsgResSend';
import { MessagePair } from '../MessagePairBase';

/**
 * 发送消息对实现
 */
export class SendMessagePair extends MessagePair<MsgReqSend, MsgResSend> {
    readonly requestName = 'ReqSend';
    readonly responseName = 'ResSend';

    isValidRequest(msg: any): msg is MsgReqSend {
        return msg && typeof msg.content === 'string';
    }

    isValidResponse(msg: any): msg is MsgResSend {
        return msg && msg.time instanceof Date;
    }
}