import WarpError from "../errors/WarpError.js";
/**
 * A patch entry from a patch scan stream.
 *
 * Pairs a decoded Patch with its commit SHA. This is the semantic
 * unit yielded by PatchJournalPort.scanPatchRange().
 */
export default class PatchEntry {
    patch;
    sha;
    constructor({ patch, sha }) {
        if (patch === null || patch === undefined) {
            throw new WarpError('PatchEntry requires a patch', 'E_INVALID_ENTRY');
        }
        if (typeof sha !== 'string' || sha.length === 0) {
            throw new WarpError('PatchEntry requires a non-empty sha', 'E_INVALID_ENTRY');
        }
        this.patch = patch;
        this.sha = sha;
        Object.freeze(this);
    }
}
