import {
    ObjectBasedClassSerializationAdapter
} from "../../../ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js";
import { InvertStatusBehavior } from "./InvertStatusBehavior.js";

export class InvertStatusBehaviorSerializationAdapter extends ObjectBasedClassSerializationAdapter {
    constructor() {
        super();

        this.klass = InvertStatusBehavior;
        this.version = 0;
    }

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {InvertStatusBehavior} value
     */
    serialize(buffer, value) {
        this.objectAdapter.serialize(buffer, value.getSource())
    }

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {InvertStatusBehavior} value
     */
    deserialize(buffer, value) {
        const source = this.objectAdapter.deserialize(buffer);

        value.setSource(source);
    }
}
