import JDLAigc from '../../core/models/jdl-aigc.js';
import { asJdlAigcType } from '../../core/basic-types/aigc-types.js';
import { formatComment } from '../../core/utils/format-utils.js';
export default { convertAigcs };
export function convertAigcs(aigcs) {
    if (!aigcs) {
        throw new Error('Relationships have to be passed so as to be converted.');
    }
    return aigcs.map(aigc => {
        const relationshipConfiguration = {
            from: aigc.from.name,
            to: aigc.to[0].image,
            type: asJdlAigcType(aigc.cardinality),
            injectedFieldInFrom: aigc.from.injectedField,
            commentInFrom: formatComment(aigc.from.documentation),
        };
        return new JDLAigc(relationshipConfiguration);
    });
}
