# Username

### Overview

The `CUsername` class represents and validates usernames within the system according to specific rules. It employs several methods to ascertain the validity of usernames based on predetermined conditions.

### Validation Mode

Validation is contingent on the following flags.

{% tabs %}
{% tab title="None" %}
If the validation flag is set to **None**, validations will be ignored.
{% endtab %}

{% tab title="PredefinedPolicy" %}
If the validation flag has **PredefinedPolicy**, its corresponding validation is performed:

* **CheckNoSpecialCharAtStart**: Validates that the username does not begin with a special character.
* **CheckNoSpecialCharAtEnd**: Validates that the username does not end with a special character.
* **CheckNoConsecutiveSpecialCharacters**: Ensures the username does not contain consecutive special characters.
  {% endtab %}

{% tab title="EmailFormat" %}
If the validation flag has **EmailFormat**, validations will verify whether the value conforms to the email format.
{% endtab %}
{% endtabs %}
