/**
 * NoOpEffectSink — null/test sink that swallows effects.
 *
 * Returns 'delivered' in live mode, 'suppressed' in replay/inspect.
 *
 * @module NoOpEffectSink
 */
import EffectSinkPort from "../../ports/EffectSinkPort.js";
import { createDeliveryObservation } from "../../domain/types/DeliveryObservation.js";
import { OUTCOME_DELIVERED, OUTCOME_SUPPRESSED, } from "../../domain/types/ExternalizationPolicy.js";
/** Default sink ID for NoOpEffectSink. */
const NOOP_SINK_ID = 'noop';
export class NoOpEffectSink extends EffectSinkPort {
    _id;
    constructor(options) {
        super();
        this._id = (options !== null && options !== undefined && options.id !== undefined && options.id !== '') ? options.id : NOOP_SINK_ID;
    }
    get id() {
        return this._id;
    }
    deliver(emission, lens) {
        if (lens.suppressExternal) {
            return Promise.resolve([createDeliveryObservation({
                    emissionId: emission.id,
                    sinkId: this._id,
                    outcome: OUTCOME_SUPPRESSED,
                    reason: `suppressed by ${lens.mode} lens`,
                    timestamp: Date.now(),
                    lens,
                })]);
        }
        return Promise.resolve([createDeliveryObservation({
                emissionId: emission.id,
                sinkId: this._id,
                outcome: OUTCOME_DELIVERED,
                timestamp: Date.now(),
                lens,
            })]);
    }
}
