"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 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 === "" ? ".day-shift/specs/index.json" : relativePath
    };
}
function resolveSpecIndexAbsolutePath(repositoryRoot) {
    return resolveSpecIndexPaths({
        root: repositoryRoot,
        detectionSource: "explicit",
        warnedAboutFallback: false
    }).absolutePath;
}
