"use strict";
/*
 * Copyright © 2020 Atomist, Inc.
 *
 * 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.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultSoftwareDeliveryMachineConfiguration = void 0;
const remoteGitProjectPersister_1 = require("@atomist/automation-client/lib/operations/generate/remoteGitProjectPersister");
const _ = require("lodash");
const allReposInTeam_1 = require("../../api-helper/command/transform/allReposInTeam");
const CachingProjectLoader_1 = require("../../api-helper/project/CachingProjectLoader");
const parameterPrompt_1 = require("../../api/context/parameterPrompt");
const DefaultRepoRefResolver_1 = require("../handlers/common/DefaultRepoRefResolver");
const GitHubCredentialsResolver_1 = require("../handlers/common/GitHubCredentialsResolver");
const rolarAndDashboardLogFactory_1 = require("../log/rolarAndDashboardLogFactory");
const TeamConfigurationPreferenceStore_1 = require("../preferences/TeamConfigurationPreferenceStore");
function defaultSoftwareDeliveryMachineConfiguration(configuration) {
    const repoRefResolver = new DefaultRepoRefResolver_1.DefaultRepoRefResolver();
    return {
        sdm: {
            projectLoader: _.get(configuration, "sdm.projectLoader") || new CachingProjectLoader_1.CachingProjectLoader(),
            logFactory: rolarAndDashboardLogFactory_1.rolarAndDashboardLogFactory(configuration),
            credentialsResolver: new GitHubCredentialsResolver_1.GitHubCredentialsResolver(),
            repoRefResolver,
            repoFinder: allReposInTeam_1.allReposInTeam(repoRefResolver),
            projectPersister: remoteGitProjectPersister_1.RemoteGitProjectPersister,
            goalScheduler: [],
            preferenceStoreFactory: TeamConfigurationPreferenceStore_1.TeamConfigurationPreferenceStoreFactory,
            parameterPromptFactory: parameterPrompt_1.commandRequestParameterPromptFactory,
        },
        local: {
            preferLocalSeeds: true,
        },
    };
}
exports.defaultSoftwareDeliveryMachineConfiguration = defaultSoftwareDeliveryMachineConfiguration;
//# sourceMappingURL=defaultSoftwareDeliveryMachineConfiguration.js.map