import { fieldTypes } from '../../../jdl/jhipster/index.js';
const { CommonDBTypes } = fieldTypes;
const { LONG: TYPE_LONG, INTEGER: TYPE_INTEGER } = CommonDBTypes;
export default function postPrepareEntity({ application, entity, }) {
    const { relationships, builtIn, name, primaryKey } = entity;
    if (builtIn && name === 'User') {
        const userIdType = primaryKey.type;
        const idField = primaryKey.fields[0];
        const idFieldName = idField.fieldName ?? 'id';
        const liquibaseFakeData = application.generateUserManagement
            ? [
                { [idFieldName]: [TYPE_INTEGER, TYPE_LONG].includes(userIdType) ? 1 : idField.generateFakeData() },
                { [idFieldName]: [TYPE_INTEGER, TYPE_LONG].includes(userIdType) ? 2 : idField.generateFakeData() },
            ]
            : [];
        entity.liquibaseFakeData = liquibaseFakeData;
        entity.fakeDataCount = liquibaseFakeData.length;
    }
    entity.anyRelationshipIsOwnerSide = relationships.some(relationship => relationship.ownerSide);
}
