# Interaction

The **Interaction** category encompasses various types of user engagement within the application, including comments, tickets, questions and answers, and contact submissions. Below are the details for each interaction model.

# Comments Model

The `comments` model is designed to facilitate user interaction by allowing individuals to leave comments on various types of content, such as posts, galleries, or products. Each comment can also serve as a response to another comment, enabling a threaded discussion format. Comments can be submitted by registered users or visitors, with necessary fields filled accordingly. Each comment can be in different statuses to indicate its approval level.

## Fields

- **id**:
    - A unique identifier for each comment. It is automatically generated by the system.

- **body**:
    - The main content of the comment. This is where users express their thoughts or feedback.

- **name**:
    - The name of the individual leaving the comment. This field is optional; it can be filled in by users who are not logged into the system.

- **email**:
    - The email address of the commenter. Similar to the name field, this is optional for users who are not registered.

- **ip**:
    - The IP address from which the comment is made. This helps track the origin of the comment for security and analysis purposes.

- **status**:
    - Indicates the current state of the comment:
        - `0`: Pending (the comment is awaiting approval).
        - `1`: Approved (the comment has been reviewed and is visible to others).
        - `-1`: Rejected (the comment was not approved and will not be displayed).

- **parent_id**:
    - If the comment is a response to another comment, this field contains the ID of the original comment. If it is a standalone comment, this field remains empty.

- **commentable_type**:
    - This field identifies the type of content the comment is associated with (e.g., post, product).

- **commentable_id**:
    - This field holds the unique identifier of the related content (e.g., the specific post or product ID).

- **commentator_type**:
    - This field indicates whether the commenter is a registered user or a guest. It helps the system understand who left the comment.

- **commentator_id**:
    - This optional field contains the ID of the user if the commenter is registered. If the commenter is a guest, this field remains empty.

---

# Tickets Model

The `tickets` model is designed to help customers submit their inquiries or issues for assistance. This system allows for effective tracking and management of customer support requests, ensuring that issues are addressed in a timely manner. Each ticket can be assigned a status to indicate its resolution stage, ensuring clarity in the support process.

## Fields

- **id**:
    - A unique identifier for each ticket. This is auto-generated by the system to ensure each ticket can be easily tracked.

- **title**:
    - A brief descriptor of the issue. It gives a quick reference point for what the ticket is about and helps the support team prioritize their responses.

- **customer_id**:
    - The unique identifier of the customer who submitted the ticket. This links the ticket to the customer’s profile for easy reference.

- **user_id**:
    - The ID of the support staff member assigned to this ticket (optional). This field can be left empty if no staff member has been assigned yet.

- **body**:
    - The detailed description of the issue or question. This field allows customers to explain their situation in detail, providing the support team with all necessary information.

- **status**:
    - Indicates the current stage of the ticket:
        - `PENDING`: The ticket has been submitted and is awaiting a response.
        - `ANSWERED`: The ticket has been responded to by the support team.
        - `CLOSED`: The issue has been resolved, and the ticket is now closed.

- **answer**:
    - The response from the support team to the customer’s inquiry. This field is optional and may not be filled out until a response is provided.

- **parent_id**:
    - Similar to comments, if this ticket is a follow-up to another ticket, this field contains the ID of the original ticket. If it's a standalone ticket, it remains empty.

- **foreign keys**:
    - The model maintains relationships with `customers` and `users`, ensuring that each ticket is correctly linked to a customer and optionally to a support staff member.


# Contact Model

The `Contact` model is designed to manage inquiries and messages from users who wish to reach out through a "Contact Us" form. This model captures essential information from users, allowing the organization to respond to queries, feedback, or issues effectively. Each submission through this model is stored securely, enabling efficient tracking and follow-up.

## Fields

- **id**:
    - A unique identifier for each contact entry. This number is automatically generated by the system to ensure every message can be easily distinguished and referred to.

- **name**:
    - The name of the person submitting the contact form. This is important for personalizing the response and addressing the user appropriately.

- **email**:
    - The email address of the individual submitting the inquiry. This field is crucial as it allows the organization to reply directly to the user regarding their submission.

- **subject**:
    - A brief topic or title for the inquiry. This field is optional and helps to summarize the main point of the message, making it easier for the organization to categorize and prioritize responses.

- **mobile**:
    - The mobile phone number of the user. This field captures the user's contact number and is often requested for follow-up calls, especially if the matter requires more immediate or personal communication.

- **hash**:
    - A unique string generated for each contact entry. This field is used internally by the system to ensure that each message can be uniquely identified, even if there are multiple messages from the same user.

- **body**:
    - The main content of the user's message. This is where the user describes their inquiry or issue in detail, providing the necessary context for the organization to understand and address the concern.

- **is_answered**:
    - A boolean field indicating whether the user's inquiry has been addressed. It defaults to `false`, meaning the inquiry is initially unanswered. Once a response is provided, this field will be updated to `true`, helping to track the status of each contact submission.

---

This structure provides a comprehensive overview of the `Comment`, `Ticket` and `Contact` models. It explains each field clearly and is designed for understanding without technical knowledge.

