import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
import { AnimationRule } from "./AnimationRule.js";
import AnimationController from "./AnimationController.js";

export class AnimationControllerSerializationAdapter extends BinaryClassSerializationAdapter {

    klass = AnimationController;
    version = 0;

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {AnimationController} value
     */
    serialize(buffer, value) {
        value.rules.toBinaryBuffer(buffer);
    }

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {AnimationController} value
     */
    deserialize(buffer, value) {
        value.rules.fromBinaryBuffer(buffer, AnimationRule);
    }
}
