== Use-case 0003 - Create Unit Listing == '''Initiating actor:''' Admin '''Other actors:''' None '''Description:''' The admin adds new apartment units to the system after a floor has been created. This includes entering all unit details such as unit number, room count, area, price, and uploading images. The unit becomes available for agents to show to clients. '''Scenario:''' 1. Admin logs in and navigates to building management. 2. System displays all buildings managed by this admin: {{{ SELECT building_id, name, address, description FROM building WHERE admin_id = (SELECT admin_id FROM admin WHERE name = 'Nikola') ORDER BY name; }}} 3. Admin selects a building e.g. "Golden Tower" building. 4. System shows all floors in the selected building: {{{ SELECT floor_id, floor_number, layout_image FROM floor WHERE building_id = (SELECT building_id FROM building WHERE name = 'Golden Tower') ORDER BY floor_number; }}} 5. Admin selects some floor e.g. Floor 1 and clicks to add a new unit within that floor. 6. System displays a form with fields: unit number, room number, floor area, price, status, images. In which the admin enters desired values 8. Admin submits the form. 9. System validates the data: {{{ SELECT COUNT(*) FROM unit WHERE floor_id = ( SELECT floor_id FROM floor WHERE building_id = (SELECT building_id FROM building WHERE name = 'Golden Tower') AND floor_number = 1 ) AND unit_number = '104'; }}} 10. System inserts the new unit: {{{ INSERT INTO unit(unit_number, room_number, floor_area, status, price, image, floorplan, vector_image, floor_id, admin_id) VALUES ( '104', 2, 82.50, 'Available', 95000.00, 'unit_104.jpg', 'plan_104.pdf', 'vector_104.svg', (SELECT floor_id FROM floor WHERE building_id = (SELECT building_id FROM building WHERE name = 'Golden Tower') AND floor_number = 1), (SELECT admin_id FROM admin WHERE name = 'Nikola') ); }}} 11. System confirms successful creation and displays the unit details.