Im trying to make a system where items decay overtime

Basically when i run a function i want all enchantments and modifiers to stay but the quality of the item will go down by 1 for example netherite>diamond>iron>stone>wood. How would i do this?

Continue to help post