/*
 * Copyright 2017 the original author or authors.
 *
 * Licensed 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.gradle.caching.internal;

import org.gradle.api.Nullable;
import org.gradle.internal.progress.BuildOperationDetails;

import java.util.SortedMap;

/**
 * Details about the build cache configuration of a build.
 *
 * This class is intentionally internal and consumed by the build scan plugin.
 *
 * @since 4.0
 */
public final class FinalizeBuildCacheConfigurationDetails implements BuildOperationDetails<FinalizeBuildCacheConfigurationDetails.Result> {

    /**
     * Represents the effective build cache configuration.
     *
     * Null values for local and remote represent a completely disabled state.
     */
    public static class Result {

        public interface BuildCacheDescription {

            String getClassName();

            String getType();

            boolean isPush();

            SortedMap<String, String> getConfig();

        }

        private final BuildCacheDescription local;

        private final BuildCacheDescription remote;

        public Result(@Nullable BuildCacheDescription local, @Nullable BuildCacheDescription remote) {
            this.local = local;
            this.remote = remote;
        }

        @Nullable // if not enabled
        public BuildCacheDescription getLocal() {
            return local;
        }

        @Nullable // if not enabled
        public BuildCacheDescription getRemote() {
            return remote;
        }
    }

}

@@ -680,16 +680,63 @@
 llable;%0A
+import org.gradle.caching.BuildCacheDescriber;%0A
 import o
@@ -827,61 +827,583 @@
 %0A * 
-Details about the build cache configuration of a buil
+Represents the transformation of the user's build cache config, to the effective configuration.%0A *%0A * This operation should occur some time after the configuration phase.%0A * In practice, it will fire as part of bootstrapping the execution of the first task to execute.%0A *%0A * This operation should always be executed, regardless of whether caching is enabled/disabled.%0A * That is, determining enabled-ness is part of %E2%80%9Cfinalizing%E2%80%9D.%0A * However, if the build fails during configuration or task graph assembly, it will not be emitted.%0A * It must fire before any build cache is use
 d.%0A 
@@ -1486,16 +1486,50 @@
 gin.%0A *%0A
+ * @see BuildCacheServiceProvider%0A
  * @sinc
@@ -1940,93 +1940,696 @@
     
-String getClassName();%0A%0A            String getType();%0A%0A            boolean isPush();%0A
+/**%0A             * The class name of the DSL configuration type.%0A             *%0A             * e.g. %7B@link org.gradle.caching.local.DirectoryBuildCache%7D%0A             */%0A            String getClassName();%0A%0A            /**%0A             * The human friendly description of the type (e.g. %22HTTP%22, %22directory%22)%0A             *%0A             * @see BuildCacheDescriber#type(String)%0A             */%0A            String getType();%0A%0A            boolean isPush();%0A%0A            /**%0A             * May contain null values.%0A             * Entries with null values are to be treated as %7B@code true%7D flag values.%0A             *%0A             * @see BuildCacheDescriber#config(String, String)%0A             */
 %0A   

Add some more docs about the finalize build cache config operation.