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

export class PacketTyping extends Packet {

    private privateKey: string = "";
    private fromPublicKey: string = "";
    private toPublicKey: string = "";

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

    public _receive(stream: Stream): void {
        this.privateKey = stream.readString();
        this.fromPublicKey = stream.readString();
        this.toPublicKey = stream.readString();
    }

    public _send(): Stream {
        const stream = new Stream();
        stream.writeInt16(this.getPacketId());
        stream.writeString(this.privateKey);
        stream.writeString(this.fromPublicKey);
        stream.writeString(this.toPublicKey);
        return stream;
    }

    public setFromPublicKey(fromPublicKey: string): void {
        this.fromPublicKey = fromPublicKey;
    }

    public setToPublicKey(toPublicKey: string): void {
        this.toPublicKey = toPublicKey;
    }

    public getFromPublicKey(): string {
        return this.fromPublicKey;
    }

    public getToPublicKey(): string {
        return this.toPublicKey;
    }

    public setPrivateKey(privateKey: string): void {
        this.privateKey = privateKey;
    }

    public getPrivateKey(): string {
        return this.privateKey;
    }
    
}