/**
 * Op — abstract base class for all WARP operations.
 *
 * Provides runtime identity (`instanceof Op`), the `type` discriminator
 * field for serialization, and the five behavior methods that the
 * reducer dispatches via `instanceof`:
 *
 *   - validate()   — structural field-shape checks
 *   - mutate()     — CRDT mutation (in place)
 *   - outcome()    — pre-mutation receipt outcome
 *   - snapshot()   — pre-mutation alive/prop snapshot
 *   - accumulate() — post-mutation diff emission
 */
import type WarpState from '../../services/state/WarpState.ts';
import type { EventId } from '../../utils/EventId.ts';
import type OpOutcomeResult from './OpOutcomeResult.ts';
import type { MutablePatchDiff } from '../PatchDiff.ts';
import type { SnapshotBeforeOp } from './SnapshotBeforeOp.ts';
export default abstract class Op<T extends string = string> {
    /** Operation type discriminator (matches wire format). */
    readonly type: T;
    /** Bit flags indicating raw, canonical, or both. See OpScope.ts. */
    readonly scope: number;
    /** TickReceipt-compatible op type string. */
    abstract readonly receiptName: string;
    constructor(type: T, scope: number);
    /** Structural field-shape checks. Throws PatchError on failure. */
    abstract validate(): void;
    /** CRDT mutation. Mutates state in place. */
    abstract mutate(state: WarpState, eventId: EventId): void;
    /** Pre-mutation receipt outcome. Reads state; does not mutate. */
    abstract outcome(state: WarpState, eventId: EventId): OpOutcomeResult;
    /** Pre-mutation snapshot used by the diff path. */
    abstract snapshot(state: WarpState): SnapshotBeforeOp;
    /** Post-mutation diff accumulation. Mutates diff in place. */
    abstract accumulate(diff: MutablePatchDiff, state: WarpState, before: SnapshotBeforeOp): void;
}
