# Professional License

The **Professional License** feature is designed to manage the lifecycle and validation of professional licenses across various industries. Each professional license is uniquely tied to a license owner, and it tracks relevant professional data, license validity, and historical status. The system allows for the integration of validation requests, ensuring that license data remains accurate and up-to-date. Here's a breakdown of the key elements:

<details>

<summary><strong>License Owner</strong></summary>

The `LicenseOwner` class represents an entity that captures essential details about the owner of a professional license. It includes information such as the owner’s name, email, identity number, and their legal data. This class also tracks the enablement status of the license (e.g., active or revoked) and stores an associated image identifier.

**Fields:**

* **`id`** (`UUID`):\
  A unique identifier for each license owner, generated using UUID.
* **`name`** (`String`):\
  The full name of the license owner.
* **`email`** (`String`):\
  The email address of the license owner. This field is unique for each license owner.
* **`identityNumber`** (`String`):\
  A unique identification number for the license owner, which could be a national ID or another form of identification.
* **`imageId`** (`String`):\
  A unique identifier for the license owner's image. It is automatically initialized with a randomly generated UUID.
* **`legalData`** (`LegalData`) : \**See Common data*\
  Legal information related to the license owner, such as tax ID, address, and identification details.
* **`enablementStatus`** (`EnablementStatus`): \**See Common data*\
  Represents the current enablement status of the license owner, which tracks whether their license is active, suspended, or revoked.

</details>

<details>

<summary>Professional Type</summary>

The type of professional is represented by the `ProfessionalType` enum, which includes various professions like *Doctor*, *Engineer*, *Architect*, and *Veterinarian*. Each profession is available in multiple languages (English, Spanish, and German).

</details>

<details>

<summary>License Category</summary>

The `LicenseCategory` enum defines various categories of licenses applicable to different professions and types of work. Each category includes a name, a description of the scope of work, the relevant professional type, and the country where the category is applicable. This enum is specifically tailored for the Argentine context, encompassing licenses for gas installers and electrical installers, among others.

**Categories include:**

* **DEFAULT**: A general category for cases where no specific license is applicable, valid globally.
* **LAWYER\_AR**: For licensed lawyers in Argentina, covering various legal services.
* **PRIMERA\_CATEGORIA\_COMBUSTION\_A\_B**: For installations without limitations on kcal/h for gas appliances.
* **PRIMERA\_CATEGORIA\_COMBUSTION\_B**: For installations with specific kcal/h limitations.
* **PRIMERA\_CATEGORIA**: For installations with lower kcal/h limitations.
* **SEGUNDA\_CATEGORIA**: For installations with consumption and pressure constraints.
* **TERCERA\_CATEGORIA\_TECNICO\_CONSTRUCTOR**: For specific household gas installations in single-family homes.
* **TERCERA\_CATEGORIA**: Similar to the previous category, also for single-family homes.
* **CATEGORIA\_I\_ELECTRICAL\_INSTALLER**: For university-trained electrical installers.
* **CATEGORIA\_II\_ELECTRICAL\_INSTALLER**: For technicians with electrical specialization.
* **CATEGORIA\_III\_ELECTRICAL\_INSTALLER**: For qualified individuals with relevant electrical training.

</details>

<details>

<summary>License Scope</summary>

The license's geographical jurisdiction is defined by `LicenseScope` and can be *National*, *Provincial*, *International*, or *Other*.

</details>

<details>

<summary>Historical Status</summary>

Represents the historical state of a professional license. It records comments regarding the professional's history, the date of the status update, and is linked to the corresponding `ProfessionalLicense`. A status can have multiple `HistoricalIssue` records, providing details of specific issues that have occurred over time.

Key Components:

* **Historical Status**:

  * Represents the historical state of a professional license.
  * Tracks comments, the date of the status update, and links to the professional license.
  * Contains a set of `HistoricalIssue` records, capturing specific issues tied to the license.

  **Fields**:

  * `id`: Unique identifier for the status.
  * `historicalComments`: Comments describing the status update.
  * `statusDate`: The timestamp for when the status was recorded.
  * `historicalIssues`: A set of issues related to this status, offering detailed historical context.
* **Historical Issue**:

  * Captures details of specific issues affecting the professional license's historical status.
  * Each issue records the type, status, a description, and an optional webhook for tracking the origin of the issue.

  **Fields**:

  * `id`: Unique identifier for the issue.
  * `issueType`: Enum defining the nature of the issue (e.g., Banned, Legal Issues, Criminal Issues), with multilingual descriptions.
  * `issueStatus`: Enum detailing the current state of the issue (e.g., Open, Resolved, Judicialized, Suspended).
  * `description`: A summary of the issue.
  * `originWebhookUrl`: Optional URL for tracking the origin or webhook associated with the issue.

#### Supporting Enums:

1. **Issue Type**:

   * Defines the type of issues a license can encounter, each with English, Spanish, and German translations. This ensures clarity for multilingual platforms.

   **Values**:

   * `BANNED`: Prohibited activity.
   * `BLACKLISTED`: Listed as untrustworthy or prohibited.
   * `LEGAL_ISSUES`: Legal complications involving the professional.
   * `CRIMINAL_ISSUES`: Criminal violations or disputes related to the license.
2. **Issue Status**:

   * Provides the status of an issue, allowing precise tracking from identification to resolution.

   **Values**:

   * `OPEN`: The issue is currently being investigated or addressed.
   * `RESOLVED`: The issue has been addressed but may require final actions.
   * `CLOSED`: The issue has been fully resolved.
   * `JUDICIALIZED`: The issue has been escalated to legal proceedings.
   * `PENALIZED`: The issue involves legal penalties or criminal charges.
   * `SUSPENDED`: The issue is on hold, pending further review.
   * `PENDING_DOCUMENTATION`: The issue requires additional documents or clarification.
   * `FINANCIALLY_PENALIZED`: A financial penalty has been imposed.
   * `ADMINISTRATIVE_REVIEW`: Under review by regulatory authorities.

This structure allows for comprehensive historical tracking of professional licenses, ensuring transparency and accountability across various legal and administrative domains, while supporting multilingual environments.cking the issue's source

</details>

**Key Fields and Features:**

1. **License Owner**:
   * The license is tied to a unique `LicenseOwner`, which represents the individual or organization managing the license.
2. **Professional Type**:
   * The type of professional is represented by the `ProfessionalType` enum, which includes various professions like *Doctor*, *Engineer*, *Architect*, and *Veterinarian*. Each profession is&#x20;
3. **License Code**:
   * Each license has a unique `licenseCode` used for identification and tracking purposes within the system.
4. **License Validity**:
   * The `is_valid` flag determines if the license is currently valid.
   * `is_expired` indicates whether the license has passed its expiration date.
   * The `emissionDate` and `renovationDate` track when the license was issued and when it needs to be renewed.
5. **Qualification and Forming Entity**:
   * Describes the professional's qualifications and the institution where they obtained their education (e.g., University or technical school).
   * `formingEntity` stores the name of the educational body, while `qualification` captures the nature of the qualification.
6. **Request Count**:
   * Tracks the number of validation requests made against the license, indicating its usage or verification frequency.

***

**Validation Request**

* The license supports validation requests through a `validationRequests` list. Each request represents an instance where the license's authenticity or validity was queried, ensuring accountability and transparency in the license management process.

Is an embeddable entity designed to capture and store details about validation requests made to the license service. It records essential information such as the request's unique identifier, the date of the request, its status, and information about the requester.

**Fields and Annotations:**

* **`id`** (`String`):\
  Represents the requester's API Key, acting as a unique identifier for the request.\
  **Constraints**: Non-updatable field.\
  **Annotation**: `@Comment("Corresponds to the requester's API Key")` provides a descriptive comment for database-level documentation.
* **`requestDate`** (`LocalDateTime`):\
  The exact date and time when the validation request was made.\
  **Constraints**: Non-updatable field.
* **`requestStatus`** (`String`):\
  Represents the current status of the request, such as "Pending", "Completed", or "Failed".\
  **Constraints**: Can be updated to reflect status changes as the request is processed.
* **`requesterUrl`** (`String`):\
  Stores the URL from which the validation request originated. This is captured at the time of the request and cannot be modified later.\
  **Constraints**: Non-updatable field.
* **`requesterIp`** (`String`):\
  Captures the IP address of the entity making the request. This provides valuable tracking information for security and auditing purposes.\
  **Constraints**: Non-updatable field.
* **`requesterEntity`** (`String`):\
  Represents the name or identifier of the entity making the request. This can be updated and may be used for tracking which organization or client requested the validation.

**Usage Scenario**

The `ValidationRequest` class is intended for use in systems where it is necessary to track and validate requests for professional license verification. For instance, when an external entity (such as a government body or business) submits a request for license validation, this class captures important details about that request.

***

The **Professional License** feature ensures accurate tracking, validation, and historical documentation of professional credentials, providing a secure and robust system for managing license-related processes.
