Interface IEnquiryService

All Known Implementing Classes:
EnquiryService

public interface IEnquiryService
Interface defining the service operations for handling enquiries in the BTO Management System.

This service interface provides methods for the complete lifecycle management of enquiries, including creation, editing, deletion, and replying. It also offers various methods for retrieving enquiries based on different criteria.

The service acts as part of the business logic layer in the application architecture, positioned between controllers and repositories, implementing all enquiry-related business rules and validation.

  • Method Details

    • createEnquiry

      Enquiry createEnquiry(User user, String projectId, String content)
      Creates a new enquiry in the system.

      Records the enquiry with metadata including the creator, creation time, and association with a project (if applicable).

      Parameters:
      user - The user creating the enquiry
      projectId - ID of the related project, or null for general enquiries
      content - The enquiry content
      Returns:
      The created enquiry with its assigned ID and metadata
    • editEnquiry

      boolean editEnquiry(String enquiryId, String newContent, User user)
      Edits an existing enquiry's content.

      The implementation should verify that the user is authorized to edit the enquiry and that the enquiry has not been replied to yet.

      Parameters:
      enquiryId - ID of the enquiry to edit
      newContent - New content for the enquiry
      user - The user editing the enquiry
      Returns:
      true if edit was successful, false otherwise
    • deleteEnquiry

      boolean deleteEnquiry(String enquiryId, User user)
      Deletes an existing enquiry from the system.

      The implementation should verify that the user is authorized to delete the enquiry and that the enquiry has not been replied to yet.

      Parameters:
      enquiryId - ID of the enquiry to delete
      user - The user deleting the enquiry
      Returns:
      true if deletion was successful, false otherwise
    • replyToEnquiry

      boolean replyToEnquiry(String enquiryId, String replyContent, HDBStaff staff)
      Adds an official reply to an existing enquiry.

      The reply is recorded with the staff member who provided it and the timestamp. Once replied to, an enquiry should be marked as such and should not be editable or deletable by the original submitter.

      Parameters:
      enquiryId - ID of the enquiry to reply to
      replyContent - The content of the reply
      staff - The HDB staff member providing the reply
      Returns:
      true if reply was successfully added, false otherwise
    • viewMyEnquiries

      List<Enquiry> viewMyEnquiries(User user)
      Retrieves all enquiries submitted by a specific user.
      Parameters:
      user - The user whose enquiries to retrieve
      Returns:
      List of enquiries submitted by the user
    • viewAllEnquiries

      List<Enquiry> viewAllEnquiries()
      Retrieves all enquiries in the system.
      Returns:
      List of all enquiries
    • viewProjectEnquiries

      List<Enquiry> viewProjectEnquiries(String projectId)
      Retrieves enquiries associated with a specific project.
      Parameters:
      projectId - ID of the project
      Returns:
      List of enquiries for the specified project
    • findEnquiryById

      Enquiry findEnquiryById(String enquiryId)
      Finds an enquiry by its unique identifier.
      Parameters:
      enquiryId - ID of the enquiry to find
      Returns:
      The enquiry if found, or null if no enquiry exists with the given ID