"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveSpecIndexPaths = resolveSpecIndexPaths;
exports.resolveSpecIndexAbsolutePath = resolveSpecIndexAbsolutePath;
const node_path_1 = __importDefault(require("node:path"));
const cli_constants_1 = require("../config/cli-constants");
const config_contract_1 = require("../config/config-contract");
function resolveSpecIndexPaths(repositoryContext) {
    const resolvedConfig = (0, config_contract_1.resolveDayShiftConfig)({
        repositoryContext: repositoryContext
    });
    const relativePath = node_path_1.default.relative(repositoryContext.root, resolvedConfig.derived.specIndexPath).replace(/\\/g, "/");
    return {
        absolutePath: resolvedConfig.derived.specIndexPath,
        relativePath: relativePath === "" ? cli_constants_1.CLI_SPEC_INDEX_PATH : relativePath
    };
}
function resolveSpecIndexAbsolutePath(repositoryRoot) {
    return resolveSpecIndexPaths({
        root: repositoryRoot,
        detectionSource: "explicit",
        warnedAboutFallback: false
    }).absolutePath;
}
