"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateLayoutPath = void 0;
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const WizError_1 = require("../modules/WizError");
const OBLIGATORY_FILE_IN_LAYOUT_FOLDER = 'settings.json';
const isObligatoryFileExists = (path) => {
    return fs_extra_1.pathExists(path_1.join(path, OBLIGATORY_FILE_IN_LAYOUT_FOLDER));
};
exports.validateLayoutPath = (layoutPath) => __awaiter(void 0, void 0, void 0, function* () {
    if (!(yield fs_extra_1.pathExists(layoutPath))) {
        throw new WizError_1.WizError('LAYOUT_NOT_EXISTS', layoutPath);
    }
    if (!(yield isObligatoryFileExists(layoutPath))) {
        throw new WizError_1.WizError('OBLIGATORY_FILE_NOT_EXISTS', OBLIGATORY_FILE_IN_LAYOUT_FOLDER, layoutPath);
    }
});
//# sourceMappingURL=validateLayoutPath.js.map