/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */
package org.apache.isis.core.plugins.environment;

/**
 * Represents configuration, that is available in an early phase of bootstrapping 
 * and should is regarded immutable during application's life-cycle.
 * 
 * @since 2.0.0-M2
 */
public interface IsisSystemEnvironment {

    // -- INTERFACE
    
    public DeploymentType getDeploymentType();
    
    // -- FACTORIES
    
    public static IsisSystemEnvironment getDefault() {
        return DEFAULT;
    }
    
    public static IsisSystemEnvironment of(DeploymentType deploymentType) {
        return ()->deploymentType;        
    }

    // -- DEFAULT IMPLEMENTATION
    
    public static final IsisSystemEnvironment DEFAULT = new IsisSystemEnvironment() {
        @Override
        public DeploymentType getDeploymentType() {
            final DeploymentType deploymentType =
                    "true".equalsIgnoreCase(System.getenv("PROTOTYPING"))
                        ? DeploymentType.PROTOTYPING
                                : DeploymentType.PRODUCTION;
            return deploymentType;
        }
    };
        
    
}



@@ -1623,44 +1623,218 @@
     
-final DeploymentType deploymentType 
+boolean anyVoteForPrototyping = false;%0A            %0A            anyVoteForPrototyping%7C=%0A                    %22true%22.equalsIgnoreCase(System.getenv(%22PROTOTYPING%22));%0A            %0A            anyVoteForPrototyping%7C
 =%0A  
@@ -1844,35 +1844,47 @@
                %22
-tru
+server-prototyp
 e%22.equalsIgnoreC
@@ -1897,35 +1897,298 @@
 stem.get
-env(%22PROTOTYPING%22))
+Property(%22isis.deploymentType%22));%0A            %0A            anyVoteForPrototyping%7C=%0A                    %22PROTOTYPING%22.equalsIgnoreCase(System.getProperty(%22isis.deploymentType%22));%0A            %0A            final DeploymentType deploymentType =%0A                    anyVoteForPrototyping
 %0A       
@@ -2294,16 +2294,29 @@
 UCTION;%0A
+            %0A
         

add "isis.deploymentType" as a config option