import { UMB_BLOCK_WORKSPACE_CONTEXT } from '../index.js';
import { UmbConditionBase } from '../../../core/extension-registry/index.js';
export class UmbBlockWorkspaceIsReadOnlyCondition extends UmbConditionBase {
    constructor(host, args) {
        super(host, args);
        this.consumeContext(UMB_BLOCK_WORKSPACE_CONTEXT, (context) => {
            this.observe(context?.readOnlyGuard.permitted, (isReadOnly) => {
                if (isReadOnly !== undefined) {
                    this.permitted = isReadOnly === (this.config.match !== undefined ? this.config.match : true);
                }
            }, 'observeIsReadOnly');
        });
    }
}
export default UmbBlockWorkspaceIsReadOnlyCondition;
