import ApertureOpeningProof from "./ApertureOpeningProof.js";
import ZKWormholeEdge from "./ZKWormholeEdge.js";
import WarpError from "../../errors/WarpError.js";
/** Rejected opening-proof verification for one cold wormhole coordinate. */
export default class RejectedApertureOpening {
    edge;
    opening;
    reason;
    constructor(edge, opening, reason) {
        if (!(edge instanceof ZKWormholeEdge)) {
            throw new WarpError('edge must be a ZKWormholeEdge', 'E_VALIDATION');
        }
        if (!(opening instanceof ApertureOpeningProof)) {
            throw new WarpError('opening must be an ApertureOpeningProof', 'E_VALIDATION');
        }
        this.edge = edge;
        this.opening = opening;
        this.reason = requireNonEmptyString(reason, 'reason');
        Object.freeze(this);
    }
}
function requireNonEmptyString(value, name) {
    if (typeof value !== 'string' || value.length === 0) {
        throw new WarpError(`${name} must be a non-empty string`, 'E_VALIDATION');
    }
    return value;
}
