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

export class PropertySetSerializationAdapter extends BinaryClassSerializationAdapter {


    klass = PropertySet;
    version = 0;

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {PropertySet} value
     */
    serialize(buffer, value) {
        buffer.writeUTF8String(JSON.stringify(value.data));
    }

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {PropertySet} value
     */
    deserialize(buffer, value) {
        const string = buffer.readUTF8String();

        value.data = JSON.parse(string);
    }
}
