java.lang.Object
com.ntu.fdae.group1.bto.models.project.Project

public class Project extends Object
Represents a BTO housing project in the system.

This class serves as the central model for housing projects in the BTO Management System. It encapsulates all the details about a Build-To-Order housing project including its basic information, location, timeline, and available flat types.

Each Project contains:
  • Project metadata (ID, name, location)
  • Timeline information (launch and application dates)
  • A collection of flat types with their associated details
  • Visibility control for public listing

Projects serve as the foundation for applications and bookings in the system, representing the housing units that citizens can apply for.

  • Constructor Details

    • Project

      public Project(String projectId, String projectName, String neighborhood, Map<FlatType,ProjectFlatInfo> flatTypes, LocalDate openingDate, LocalDate closingDate, String managerNric, int maxOfficerSlots)
      Constructs a new Project with the specified details.
      Parameters:
      projectId - The unique identifier for the project
      projectName - The name of the housing project
      neighborhood - The location or address of the project
      flatTypes - A map of flat types available in this project
      openingDate - The date when the application period opens
      closingDate - The date when the application period closes
      managerNric - The NRIC of the manager assigned to this project
      maxOfficerSlots - The maximum number of officer slots available for this project
  • Method Details

    • getProjectId

      public String getProjectId()
      Gets the unique identifier for this project.
      Returns:
      The project ID
    • getProjectName

      public String getProjectName()
      Gets the name of this housing project.
      Returns:
      The project name
    • getNeighborhood

      public String getNeighborhood()
      Gets the neighborhood of this project.

      The neighborhood represents the geographical area where the BTO project is located in Singapore.

      Returns:
      The neighborhood location name
    • getFlatTypes

      public Map<FlatType,ProjectFlatInfo> getFlatTypes()
      Gets the map of flat types available in this project.

      Returns a mapping of each FlatType to its corresponding ProjectFlatInfo object, which contains details like unit count, price, and availability information.

      Returns:
      A map of flat types to their associated information
    • getOpeningDate

      public LocalDate getOpeningDate()
      Gets the date when the application period opens.

      This date marks the beginning of the period when applicants can submit their applications for this BTO project.

      Returns:
      The opening date for applications
    • getClosingDate

      public LocalDate getClosingDate()
      Gets the date when the application period closes.

      This date marks the end of the period when applications will be accepted for this BTO project.

      Returns:
      The closing date for applications
    • getManagerNric

      public String getManagerNric()
      Gets the NRIC of the manager assigned to this project.

      Each BTO project is assigned an HDB manager who has overall responsibility for the project's administration and oversight.

      Returns:
      The manager's NRIC identifier
    • getMaxOfficerSlots

      public int getMaxOfficerSlots()
      Gets the maximum number of officer slots available for this project.

      This value represents the total number of HDB officers that can be assigned to work on this project simultaneously.

      Returns:
      The maximum number of officer slots
    • getRemainingOfficerSlots

      public int getRemainingOfficerSlots()
      Gets the remaining number of officer slots available for this project.

      This value represents how many more HDB officers can be assigned to this project before reaching the maximum capacity.

      Returns:
      The remaining number of officer slots
    • isVisible

      public boolean isVisible()
      Gets the visibility status of this project.
      Returns:
      true if the project is visible, false otherwise
    • getApprovedOfficerNrics

      public List<String> getApprovedOfficerNrics()
      Gets the list of NRICs of HDB officers approved to work on this project.
      Returns:
      The list of approved officer NRICs
    • setVisibility

      public void setVisibility(boolean visible)
      Sets the visibility status of this project.
      Parameters:
      visible - The visibility status to set
    • getFlatInfo

      public ProjectFlatInfo getFlatInfo(FlatType flatType)
      Gets information about a specific flat type in this project.
      Parameters:
      flatType - The flat type to get information for
      Returns:
      The flat type information, or null if the flat type is not available in this project
    • setProjectName

      public void setProjectName(String projectName)
      Sets the project name.
      Parameters:
      projectName - The new name, must not be null or blank (after trimming).
      Throws:
      IllegalArgumentException - if projectName is null or blank.
    • setNeighborhood

      public void setNeighborhood(String neighborhood)
      Sets the project neighborhood.
      Parameters:
      neighborhood - The new neighborhood, must not be null or blank (after trimming).
      Throws:
      IllegalArgumentException - if neighborhood is null or blank.
    • setOpeningDate

      public void setOpeningDate(LocalDate openingDate)
      Sets the project opening date. Ensures the new opening date is not after the current closing date (if set).
      Parameters:
      openingDate - The new opening date. Can be null.
      Throws:
      IllegalArgumentException - if the new openingDate is after the existing closingDate.
    • setClosingDate

      public void setClosingDate(LocalDate closingDate)
      Sets the project closing date. Ensures the new closing date is not before the current opening date (if set).
      Parameters:
      closingDate - The new closing date. Can be null.
      Throws:
      IllegalArgumentException - if the new closingDate is before the existing openingDate.
    • setMaxOfficerSlots

      public void setMaxOfficerSlots(int maxOfficerSlots)
      Sets the maximum number of officer slots available for this project.
      Parameters:
      maxOfficerSlots - The maximum number of officer slots to set
    • setFlatTypes

      public void setFlatTypes(Map<FlatType,ProjectFlatInfo> flatTypes)
      Sets the entire map of flat types for this project. Used by the repository during loading. Creates defensive copies.
      Parameters:
      flatTypes - A map where the key is the FlatType enum and the value is the ProjectFlatInfo object.
    • setApprovedOfficerNrics

      public void setApprovedOfficerNrics(List<String> approvedOfficerNrics)
      Sets the entire list of approved officer NRICs for this project. Used by the repository during loading. Creates defensive copies.
      Parameters:
      approvedOfficerNrics - A list of strings containing the NRICs.
    • addApprovedOfficer

      public boolean addApprovedOfficer(String officerNric)
      Adds an officer to the list of officers approved to work on this project.
      Parameters:
      officerNric - The NRIC of the officer to add
      Returns:
      true if the officer was added, false otherwise
    • removeApprovedOfficer

      public boolean removeApprovedOfficer(String officerNric)
      Removes an officer from the list of officers approved to work on this project.
      Parameters:
      officerNric - The NRIC of the officer to remove
      Returns:
      true if the officer was removed, false if the officer was not in the list
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object