# Flutter Mobile App API Documentation (Owner Role) Base URL: http://127.0.0.1:8000/api Note: For testing on a real physical mobile device, replace 127.0.0.1 with your computer's local IP address (e.g., 192.168.1.5). ## Authentication - POST /login - Params: email, password - Returns: CSRF cookie and session (for web-based auth) or Auth token (if configured). - POST /logout - Action: End session - GET /profile - Returns: Current logged-in user details and role. ## Branch Management - GET /branches - List all branches. - POST /branches - Create new branch (Multipart/form-data for documents). - GET /branches/{id} - View specific branch details. - PUT /branches/{id} - Update branch details. - DELETE /branches/{id} - Delete a branch. - GET /branches/{branch}/receptionist - View receptionist for a branch. - POST /branches/{branch}/receptionist - Create/Update receptionist credentials. - DELETE /branches/{branch}/receptionist - Remove receptionist. ## Staff Management - GET /staff - List all staff members. - POST /staff - Add new staff (Multipart/form-data for documents). - GET /staff/{id} - View staff profile. - PUT /staff/{id} - Update staff profile. - DELETE /staff/{id} - Delete staff member. - GET /staff/pending-salaries - List all pending salaries across branches. - POST /staff/bulk-settle - Params: staff_ids[] - Settle multiple salaries at once. - GET /staff/{id}/payments - Salary payment history. - GET /staff/{id}/payroll-status - Current month's payroll calculation. - POST /staff/{id}/settle - Settle individual salary for a month. - GET /staff/{id}/advance-history - List of advance payments and deductions. ## Investor & ROI Management - GET /investors - List all investors. - POST /investors - Add new investor (Multipart/form-data for documents). - GET /investors/{id} - View investor details. - PUT /investors/{id} - Update investor. - DELETE /investors/{id} - Delete investor. - GET /investors/pending-roi - List all pending ROI settlements. - GET /investors/{id}/roi-status - Monthly ROI status breakdown (Base ROI, Carry Over, Paid, Net Due). - POST /investors/{id}/settle-roi - Params: payout_month, amount, payout_date, payment_method, remarks. - Settle a month's ROI. ## Financials & Expenses - GET /accounts - General ledger of all credit/debit transactions. - GET /expenses - List of all business expenses. - POST /expenses - Params: date, branch_id, expense_category_id, expense_type (Account/Petty Cash), amount, remarks. - Record a new expense. - GET /expense-categories - List of master expense categories. ## Inventory Management - GET /inventory/products - List all products and stock levels. - POST /inventory/products - Add new product with image. - POST /inventory/products/{id}/adjust - Adjuts stock (Add/Remove) with remarks. - GET /inventory/products/{id}/history - Stock movement history for a specific product. - GET /inventory/sales - List of all POS sales. - POST /inventory/sales - Record a new product sale. - GET /inventory/movements - Global stock movement log. ## Collections - GET /collections - List all daily collections. - POST /collections - Record new collection. - GET /collections/{id} - View collection details. ## Reports - GET /reports/profit - Profit & Loss report (Income vs Expenses). - GET /reports/expiry-reminders - Documents (Trade license, staff IDs, etc.) expiring soon. - GET /reports/investments - Summary of total investments and ROI distributed. ## Master Settings - GET /masters/{type} - Types: expense_categories, product_categories, payment_methods, etc. - POST /masters/{type} - Add master entry. - PUT /masters/{type}/{id} - Edit master entry. - DELETE /masters/{type}/{id} - Delete master entry.