import type { MutablePatchDiff } from '../types/PatchDiff.ts';
import type OpOutcomeResult from '../types/ops/OpOutcomeResult.ts';
import type { EventId } from '../utils/EventId.ts';
import type { OpLike } from './OpLike.ts';
import type { SnapshotBeforeOp } from './SnapshotBeforeOp.ts';
import type WarpState from './state/WarpState.ts';
/**
 * Abstract base for per-op-type dispatch strategies.
 *
 * Subclasses override the five methods below. The registry
 * `OP_STRATEGIES` pins one instance per canonical op type.
 */
export default abstract class OpStrategy {
    /** TickReceipt-compatible op type string (e.g. `NodeTombstone` for NodeRemove). */
    abstract readonly receiptName: string;
    /** Structural field-shape checks. Throws `PatchError` on failure. */
    abstract validate(op: OpLike): void;
    /** CRDT mutation. Mutates `state` in place. */
    abstract mutate(state: WarpState, op: OpLike, eventId: EventId): void;
    /** Pre-mutation receipt outcome. Reads state; does not mutate. */
    abstract outcome(state: WarpState, op: OpLike, eventId: EventId): OpOutcomeResult;
    /** Pre-mutation snapshot used by the diff path. Reads state; does not mutate. */
    abstract snapshot(state: WarpState, op: OpLike): SnapshotBeforeOp;
    /** Post-mutation diff accumulation. Mutates `diff` in place. */
    abstract accumulate(diff: MutablePatchDiff, state: WarpState, op: OpLike, // nosemgrep: ts-no-like-types -- 0025C
    before: SnapshotBeforeOp): void;
    /** Shared mutate logic for NodePropSet / EdgePropSet / legacy PropSet. */
    protected static _mutateProp(state: WarpState, mutation: {
        readonly propKey: string;
        readonly eventId: EventId;
        readonly value: unknown;
    }): void;
    /** Shared pre-op snapshot for property strategies. */
    protected static _snapshotProp(state: WarpState, propKey: string): SnapshotBeforeOp;
    /** Shared diff accumulator for property strategies. */
    protected static _accumulatePropDiff(diff: MutablePatchDiff, state: WarpState, change: {
        readonly nodeId: string;
        readonly key: string;
        readonly before: SnapshotBeforeOp;
    }): void;
}
