import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
import { UUID } from "./UUID.js";

export class UUIDSerializationAdapter extends BinaryClassSerializationAdapter {
    klass = UUID
    version = 0

    /**
     *
     * @param buffer
     * @param {UUID} value
     */
    serialize(buffer, value) {
        buffer.writeUint8Array(value.data, 0, 16);
    }

    /**
     *
     * @param buffer
     * @param {UUID} value
     */
    deserialize(buffer, value) {
        buffer.readUint8Array(value.data, 0, 16);
    }
}
