import Packet from "../packet";
import Stream from "../stream";


/**
 * Запрашивает сервер обновлений
 */
export class PacketRequestUpdate extends Packet {

    private updateServer: string = "";

    public getPacketId(): number {
        return 0xA;
    }

    public _receive(stream: Stream): void {
        this.updateServer = stream.readString();
    }

    public _send(): Promise<Stream> | Stream {
        let stream = new Stream();
        stream.writeInt16(this.getPacketId());
        stream.writeString(this.updateServer);
        return stream;
    }
    
    public setUpdateServer(updateServer: string) {
        this.updateServer = updateServer;
    }

    public getUpdateServer(): string {
        return this.updateServer;
    }

}