Automatically incrementing script attribute names on creation

I was wondering if there was a way to automatically add an index to a script attribute on creation.

I have this code:

UiGlobalSettings.attributes.add('fontStyles', {
    type: 'json', array: true,
    schema: [{ name: 'styleName', type: 'string', enum: [{ 'heading': 'heading' }, { 'subHeading': 'subHeading' }, { 'paragraph': 'paragraph' }, { 'button': 'button' }] }, { name: 'font', type: 'asset', assetType: 'font' }]
});

I’d like it to function so that when the other devs add a new entry and select e.g. “heading” as the styleName some code could count all other “heading” examples and add an index so the first would be called “heading_0”, “heading_1” etc.

maybe I’m going about this all wrong… any ideas?