function isNonEmpty(value) {
    return !!value && value.trim().length > 0;
}
export function validateWorkspaceConfig(config) {
    const errors = [];
    if (!isNonEmpty(config.id))
        errors.push("Workspace id is required");
    if (!isNonEmpty(config.label))
        errors.push("Workspace label is required");
    if (config.type === "git") {
        if (!isNonEmpty(config.remoteUrl))
            errors.push("Git remote URL is required");
        if (typeof config.rootPath !== "string")
            errors.push("Git rootPath must be a string");
        if (!config.auth || config.auth.type !== "pat")
            errors.push("Git auth is required");
        const anyCfg = config;
        if (anyCfg.provider && !["auto", "github", "gitlab", "bitbucket", "gitea"].includes(anyCfg.provider)) {
            errors.push("Git provider must be one of: auto, github, gitlab, bitbucket, gitea");
        }
        if (anyCfg.apiBaseUrl && typeof anyCfg.apiBaseUrl !== "string") {
            errors.push("Git apiBaseUrl must be a string");
        }
    }
    if (config.type === "sparql") {
        if (!isNonEmpty(config.endpoint))
            errors.push("SPARQL endpoint is required");
        if (!isNonEmpty(config.workspaceIri))
            errors.push("Workspace IRI is required");
    }
    return { valid: errors.length === 0, errors };
}
//# sourceMappingURL=validateWorkspaceConfig.js.map