# Use Case Documentation: KROW Client Mobile App

## 1. App Initialization

*   **Primary Actor:** System (Automated) / Business Client
*   **Description:** The initial sequence that determines the user's state (authenticated or not) and routes them to the appropriate starting screen.
*   **Preconditions:** User has launched the application.
*   **Main Flow:**
    1.  User opens the app.
    2.  System checks the local authentication status.
    3.  **If Authenticated:** System routes the user directly to the **Home Dashboard**.
    4.  **If Unauthenticated:** System routes the user to the **Authentication Flow**.

---

## 2. User Authentication

*   **Primary Actor:** Business Client
*   **Description:** The process of logging in to access the platform's features or recovering a lost password.
*   **Preconditions:** User is on the Sign-In screen.
*   **Main Flow (Sign In):**
    1.  User enters their registered email and password.
    2.  User taps "Sign In".
    3.  System verifies the credentials against the backend.
    4.  **On Success:** User is redirected to the **Home Dashboard**.
*   **Alternative Flow (Forgot Password):**
    1.  User taps "Forgot Password".
    2.  User enters their email address.
    3.  System sends a password reset link.
    4.  User follows the email instructions to reset credentials.

---

## 3. Main App Navigation

*   **Primary Actor:** Business Client
*   **Description:** The central hub where users can access different functional areas of the business management suite.
*   **Preconditions:** User is logged in and on the Home Dashboard.
*   **Main Flow:**
    1.  User views the dashboard summary.
    2.  User selects a navigation option:
        *   **Events:** To manage upcoming shifts.
        *   **Hubs:** To manage venues and departments.
        *   **Invoices:** To handle billing and payments.
        *   **Profile:** To manage business settings and support.

---

## 4. Hub & Venue Management

*   **Primary Actor:** Business Client
*   **Description:** Configuring the physical locations (Hubs) and internal teams (Departments) where shifts will take place.
*   **Preconditions:** User is in the "Hubs" section.
*   **Main Flow:**
    1.  User views the list of existing Hubs.
    2.  User taps "Add New Hub".
    3.  User enters venue details (Name, Address, Photo).
    4.  System validates the address via map services.
    5.  User adds specific "Departments" (e.g., Kitchen, Bar) to the Hub.
    6.  User saves the configuration.

---

## 5. Event Management

*   **Primary Actor:** Business Client
*   **Description:** Creating, publishing, and managing events and their associated staffing requirements.
*   **Preconditions:** User is in the "Events" section and has at least one Hub configured.
*   **Main Flow:**
    1.  User views the list of events (Upcoming, Active, Past).
    2.  User taps "Create New Event".
    3.  User selects a Hub and sets the date/time.
    4.  User defines "Shifts" by adding "Positions" (Role, Quantity, Rate).
    5.  User reviews the estimated cost.
    6.  User publishes the event to the marketplace.

---

## 6. Operations (Live Management)

*   **Primary Actor:** Business Client
*   **Description:** Monitoring real-time staff attendance, managing check-ins, and handling operational alerts during an event.
*   **Preconditions:** An event is active or upcoming with assigned staff.
*   **Main Flow:**
    1.  User views details of an active event.
    2.  User monitors the "Assigned Staff" list.
    3.  User taps a staff member to view their profile, skills, and status.
    4.  **Manual Action:** If a staff member cannot scan a QR code, the user manually clocks them In/Out.
    5.  **Alerts:** User receives real-time notifications (e.g., "Staff is Late") and takes action.

---

## 7. Staff Feedback

*   **Primary Actor:** Business Client
*   **Description:** Providing performance ratings for staff members after their shifts are completed.
*   **Preconditions:** A shift has ended.
*   **Main Flow:**
    1.  User selects a completed shift or receives a "Rate Staff" prompt.
    2.  User selects a staff member.
    3.  User assigns a star rating (1-5) and optional tags/comments.
    4.  User submits the rating to the system.

---

## 8. Finance Management

*   **Primary Actor:** Business Client
*   **Description:** Managing the financial aspects of the account, including viewing invoice history and downloading documents.
*   **Preconditions:** User is in the "Invoices" section.
*   **Main Flow:**
    1.  User views a list of all invoices.
    2.  User checks the status (Paid, Due, Overdue).
    3.  User selects an invoice to view details.
    4.  User taps "Download PDF" for accounting records.

---

## 9. Profile Management

*   **Primary Actor:** Business Client
*   **Description:** Managing business identity, app settings, and accessing support.
*   **Preconditions:** User is in the "Profile" section.
*   **Main Flow:**
    1.  User views their business profile details.
    2.  **Edit Details:** User updates business name, logo, or contact info.
    3.  **Notifications:** User toggles push notification preferences.
    4.  **Support:** User accesses the Help Center or contacts customer support.

---

# Use Case Diagram

```mermaid
flowchart TD        
       subgraph AppInitialization                                                                                                                                                               
           A[Start App] --> B{Check Auth Status};                                                                                                                                               
           B -- Authenticated --> C[Go to Home];                                                                                                                                                
           B -- Unauthenticated --> D[Go to Auth];                                                                                                                                              
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph UserAuthentication                                                                                                                                                              
           D --> G[Sign In Screen];                                                                                                                                                             
           G --> H{Action};                                                                                                                                                          
           H -- Sign In --> I[Enter Email & Password];                                                                                                                                              
           I --> J[Verify Credentials];                                                                                                                                                          
           J -- Success --> C;                                                                                                                                                                  
           H -- Forgot Password --> K[Reset via Email];                                                                                                                                           
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph MainApp                                                                                                                                                                         
           C --> AC[Home Dashboard];                                                                                                                                                               
           AC --> AD{Navigate};                                                                                                                                                                 
           AD -- Events --> AE[Event Management];                                                                                                                                               
           AD -- Hubs --> AF[Hub & Venue Management];                                                                                                                                          
           AD -- Invoices --> AG[Finance & Invoices];                                                                                                                                            
           AD -- Profile --> AH[Profile Management];                                                                                                                                            
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph HubManagement                                                                                                                                                                 
           AF --> AI[View Hubs List];                                                                                                                                                              
           AI --> AJ[Add New Hub/Venue];                                                                                                                                                       
           AJ --> AK[Configure Departments];                                                                                                                                                      
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph EventManagement                                                                                                                                                              
           AE --> AL[View Events List];                                                                                                                                                    
           AL --> AM[Create New Event];                                                                                                                                                    
           AM --> AN[Define Shifts & Positions];                                                                                                                                            
           AN --> AO[Review & Publish Shift];                                                                                                                                                   
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph Operations                                                                                                                                                               
           AL --> AP[Active/Upcoming Event Details];                                                                                                                                                             
           AP --> AQ[Monitor Assigned Staff];                                                                                                                                                          
           AQ --> AR[View Staff Profile & Status];                                                                                                                                                      
           AQ --> AS[Manual Clock In/Out];                                                                                                                                                          
           AP --> AT[Receive Real-time Alerts];                                                                                                                                                      
       end                                                                                                                                                                                      
                                                                                                                                                                                                
       subgraph StaffFeedback                                                                                                                                                                      
           AS --> AU[Post-Shift Rating];                                                                                                                                                      
           AU --> AV[Rate Staff Performance];                                                                                                                                                      
       end

       subgraph FinanceManagement                                                                                                                                                                      
           AG --> AW[View Invoices];                                                                                                                                                      
           AW --> AX[Check Payment Status];                                                                                                                                                      
           AW --> AY[Download Invoice PDF];                                                                                                                                                      
       end

       subgraph ProfileManagement                                                                                                                                                               
           AH --> AZ[View Business Profile];                                                                                                                                                             
           AZ --> BA[Edit Business Details];                                                                                                                                                      
           AZ --> BB[Manage Notifications];                                                                                                                                                      
           AZ --> BC[Access Support];                                                                                                                                                           
       end
```