import { Transform } from "../ecs/transform/Transform.js";
import { Interpoland } from "./Interpoland.js";
import { PoseInterpolationAdapter } from "./PoseInterpolationAdapter.js";
import { TransformPoseSerializationAdapter } from "./TransformPoseSerializationAdapter.js";

/**
 * Interpolation-log type id for the {@link Transform} pose interpoland. Type ids
 * distinguish interpoland kinds under one entity key; pose is the first (0).
 * When more kinds land, an interpolation registry should assign these so they
 * can't collide. (For replicated entities this must eventually align with the
 * network's replicated-component type id — tracked in INTEPOLATION_SYSTEM_PLAN.)
 * @type {number}
 */
export const POSE_TYPE_ID = 0;

/**
 * Shared, stateless pose interpoland: blend a body's {@link Transform} position
 * + rotation. Reused across every entity that interpolates its pose — a body
 * opting in carries an `Interpolated` whose `interpolands` is `[POSE_INTERPOLAND]`.
 * @type {Interpoland}
 */
export const POSE_INTERPOLAND = new Interpoland(
    POSE_TYPE_ID,
    Transform,
    new TransformPoseSerializationAdapter(),
    new PoseInterpolationAdapter(),
);
