import { toCamelCase, toKebabCase, toPascalCase } from './string-utils.js';
export function getAdditionalApiPaths(additionalApi) {
    // path example: "/iam/accounts/get/from/user"
    const segments = additionalApi.path.split('/').filter(Boolean).map(s => toKebabCase(s));
    if (segments.length < 3)
        throw new Error(`Invalid additional api path: ${additionalApi.path}`);
    const pathBoundedContext = segments.shift();
    const pathAction = segments.pop();
    return { pathAction, pathBoundedContext, pathSegments: segments };
}
export function getAdditionalApiFileName(additionalApi) {
    const p = getAdditionalApiPaths(additionalApi);
    return `${toKebabCase(p.pathBoundedContext)}-${toKebabCase(p.pathAction)}-${p.pathSegments.join('-')}`;
}
export function getClassNameAdditionalApi(additionalApi) {
    const p = getAdditionalApiPaths(additionalApi);
    return toPascalCase(p.pathBoundedContext) + toPascalCase(p.pathAction) + p.pathSegments.map(s => toPascalCase(s)).join('');
}
export function getResolverNameAdditionalApi(additionalApi) {
    const p = getAdditionalApiPaths(additionalApi);
    return toCamelCase(p.pathBoundedContext) + toPascalCase(p.pathAction) + p.pathSegments.map(s => toPascalCase(s)).join('');
}
export function getVariableNameAdditionalApi(additionalApi) {
    const p = getAdditionalApiPaths(additionalApi);
    return toCamelCase(p.pathAction) + p.pathSegments.map(s => toPascalCase(s)).join('');
}
