import { UMB_SERVER_CONTEXT } from '../server.context-token.js';
import { UmbConditionBase } from '../../extension-registry/index.js';
const ObserveSymbol = Symbol();
export class UmbIsServerProductionModeCondition extends UmbConditionBase {
    constructor(host, args) {
        super(host, args);
        // Default to not permitted until we know the server's runtime mode (safe default).
        this.permitted = false;
        this.consumeContext(UMB_SERVER_CONTEXT, (context) => {
            this.observe(context?.isProductionMode, (isProduction) => {
                if (isProduction !== undefined) {
                    this.permitted = isProduction === (this.config.match ?? true);
                }
            }, ObserveSymbol);
        });
    }
}
