Enchantment is a modifier that adds special abilities to items when applied.
Properties
The enchantment mod element has the following properties:
Enchantment name: It is the displayed name of your enchantment.
Enchantment type: This property will define which item type your enchantment can be applied (in the enchanting table only).
Enchantment rarity: It is the rarity of your enchantment to be on an item (inside the enchanting table and for loot tables)
Minimal and maximal supported level: The minimal and the maximal level that your enchantment supports.
Damage reduction modifier: This value will be multiplied with the level of the enchantment (that the item has currently) to get the number of damage, your enchantment will protect. For example, PROTECTION has a value of 1, so for the first level, the enchantment will protect the player of 1 damage as 1 (level) * 1 (your value) = 1.
Is this enchantment treasure enchantment?: A treasure enchantment can not be found in the enchanting table. It can only be found in a loot table, like MENDING or more recently, SOUL SPEED (1.16).
Is this enchantment curse?: Enchantments with this property are bad (their name are red). CURSE OF VANISHING and CURSE OF BINDING have this property.
is this enchantment allowed on books?: Check this option to have an enchanted book of your enchantment. You can't define the Creative tab, as it is defined by the enchantment type you have defined at the beginning.
Can be combined with: If your enchantment can only be combined with specific enchantments, you need to select them in this property. Leave empty to allow combining with any enchantment.
Can be applied to: In this field, select the items that can receive the enchantment in the enchanting table. You can also add items that aren't in the enchantment type you have defined. For example, I select ARMOR for the enchantment type, but I want to have only my custom armor. In this field, I will choose the helmet, the chestplate, the leggings and the boots of my custom armor, so only these four items will be able to have this enchantment inside the enchanting table.
Adding an event to the enchantment
Enchantments alone do not provide any triggers. Enchantments are meant to be used as a modifier to custom actions defined by procedures.
To be able to add an action/event to your enchantment you need to create a procedure with a Global trigger or selected trigger of your custom elements.
Then, use the procedure block named "Get level of the enchantment" for each level of your enchantment. Finally, add the actions your enchantment will do when the procedure is triggered.
Video tutorial
If you prefer to watch the video, you can find the wiki page above (plus examples how to use (global) triggers to make enchantments do something) summarized in a video:
And another video covering this mod element: