import { JSONPointer } from "../pointer";
import { JSONValue } from "../types";
export type OpObject = {
    op: string;
    path: string;
    value?: JSONValue;
    from?: string;
};
/**
 * A JSON Patch operation.
 */
export interface Op {
    /**
     * The patch operation name.
     */
    name: string;
    /**
     * Apply the patch operation to _value_.
     * @param value - The target JSON value.
     */
    apply: (value: JSONValue, index: number) => JSONValue;
    /**
     * A plain object representation of the patch operation.
     */
    toObject: () => OpObject;
}
/**
 * The JSON Patch _add_ operation.
 */
export declare class OpAdd implements Op {
    readonly path: JSONPointer;
    readonly value: JSONValue;
    name: string;
    constructor(path: JSONPointer, value: JSONValue);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
}
/**
 * The JSON Patch _remove_ operation.
 */
export declare class OpRemove implements Op {
    readonly path: JSONPointer;
    name: string;
    constructor(path: JSONPointer);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
}
/**
 * The JSON Patch _replace_ operation.
 */
export declare class OpReplace implements Op {
    readonly path: JSONPointer;
    readonly value: JSONValue;
    name: string;
    constructor(path: JSONPointer, value: JSONValue);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
}
/**
 * The JSON Patch _move_ operation.
 */
export declare class OpMove implements Op {
    readonly from: JSONPointer;
    readonly path: JSONPointer;
    name: string;
    constructor(from: JSONPointer, path: JSONPointer);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
}
/**
 * The JSON Patch _copy_ operation.
 */
export declare class OpCopy implements Op {
    readonly from: JSONPointer;
    readonly path: JSONPointer;
    name: string;
    constructor(from: JSONPointer, path: JSONPointer);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
    protected deepCopy(value: JSONValue): JSONValue;
}
/**
 * The JSON Patch _test_ operation.
 */
export declare class OpTest implements Op {
    readonly path: JSONPointer;
    readonly value: JSONValue;
    name: string;
    constructor(path: JSONPointer, value: JSONValue);
    apply(value: JSONValue, index: number): JSONValue;
    toObject(): OpObject;
}
/**
 *
 */
export declare class JSONPatch {
    private ops;
    /**
     *
     * @param ops -
     */
    constructor(ops?: OpObject[]);
    /**
     * @returns an iterator over ops in this patch.
     */
    [Symbol.iterator](): Iterator<OpObject>;
    /**
     *
     * @param path -
     * @param value -
     * @returns
     */
    add(path: string | JSONPointer, value: JSONValue): this;
    /**
     *
     * @param path -
     */
    remove(path: string | JSONPointer): this;
    /**
     *
     * @param path -
     * @param value -
     * @returns
     */
    replace(path: string | JSONPointer, value: JSONValue): this;
    /**
     *
     * @param from -
     * @param path -
     * @returns
     */
    move(from: string | JSONPointer, path: string | JSONPointer): this;
    /**
     *
     * @param from -
     * @param path -
     * @returns
     */
    copy(from: string | JSONPointer, path: string | JSONPointer): this;
    /**
     *
     * @param path -
     * @param value -
     * @returns
     */
    test(path: string | JSONPointer, value: JSONValue): this;
    /**
     *
     * @param value -
     */
    apply(value: JSONValue): JSONValue;
    /**
     *
     * @returns
     */
    toArray(): OpObject[];
    protected build(ops: OpObject[]): void;
    protected opPointer(opObj: OpObject, key: keyof OpObject, op: string, index: number): JSONPointer;
    protected opValue(opObj: OpObject, key: keyof OpObject, op: string, index: number): JSONValue;
    protected ensurePointer(p: JSONPointer | string, op: string, index: number): JSONPointer;
}
