import { upperFirst } from 'lodash-es';
export const javaBeanCase = (beanName) => {
    const secondLetter = beanName.charAt(1);
    if (secondLetter && secondLetter === secondLetter.toUpperCase() && isNaN(parseInt(secondLetter, 10))) {
        return beanName;
    }
    return upperFirst(beanName);
};
export const buildJavaGet = reference => {
    let refPath;
    if (typeof reference === 'string') {
        refPath = [reference];
    }
    else if (Array.isArray(reference)) {
        refPath = reference;
    }
    else {
        refPath = [reference.name];
    }
    return refPath.map(partialPath => `get${javaBeanCase(partialPath)}()`).join('.');
};
export const buildJavaGetter = (reference, type = reference.type) => {
    return `${type} get${javaBeanCase(reference.name)}()`;
};
export const buildJavaSetter = (reference, valueDefinition = `${reference.type} ${reference.name}`) => {
    return `set${javaBeanCase(reference.name)}(${valueDefinition})`;
};
