import { CreateArgs, CreateResult, DeleteArgs, DeleteResult, DuplicateArgs, DuplicateResult, PaginatedList, SearchResults, TSGetArgs, TSGetSingletonArgs, TSListArgs, TSSearchArgs, UpdateArgs, UpdateResult } from "./templates.js";
const templateMappings = {
    TSGetArgs,
    TSGetSingletonArgs,
    TSListArgs,
    TSSearchArgs,
    CreateArgs,
    UpdateArgs,
    DuplicateArgs,
    DeleteArgs,
    PaginatedList,
    SearchResults,
    CreateResult,
    UpdateResult,
    DuplicateResult,
    DeleteResult
};
export function resolveTemplate(projectSchema, templateName, shapeName) {
    const mapping = templateMappings[templateName];
    if (!mapping) {
        throw new Error(`Invalid shape template ${templateName}`);
    }
    if (projectSchema.shapes[shapeName] === undefined) {
        throw new Error(`Unknown shape "${shapeName}" in template "${templateName}"`);
    }
    return mapping({ projectSchema }, projectSchema.shapes[shapeName]);
}
/**
 * Check if a string is a known template such as `PaginatedList`
 */
export function isValidTemplate(template) {
    return Boolean(templateMappings[template]);
}
