# Use Case Documentation: Krow Staff Mobile App

## 1. App Initialization

*   **Primary Actor:** System (Automated) / Staff Member
*   **Description:** The initial sequence that determines the user's state (authenticated, verified, or pending) 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 and verification status.
    3.  **If Authenticated & Active:** System routes to **Home Dashboard**.
    4.  **If Unauthenticated:** System routes to **Authentication Flow**.
    5.  **If Pending Admin:** System routes to **Waiting Validation**.
    6.  **If Incomplete Profile:** System routes to **Checklist**.

---

## 2. User Authentication

*   **Primary Actor:** Staff Member
*   **Description:** The process of logging in or registering a new account.
*   **Preconditions:** User is on the Welcome Screen.
*   **Main Flow:**
    1.  User selects "Sign In" or "Sign Up".
    2.  **Sign In:** User enters email and verifies via code/link.
    3.  **Sign Up:** User enters details and proceeds to **User Onboarding**.

---

## 3. User Onboarding

*   **Primary Actor:** New Staff Member
*   **Description:** Collecting initial necessary data to create a profile account.
*   **Preconditions:** User is in the Sign-Up flow.
*   **Main Flow:**
    1.  User enters personal information (Name, Phone).
    2.  User verifies email address.
    3.  User adds emergency contacts.
    4.  User defines their address and working radius.
    5.  User selects their primary roles (e.g., Waiter, Chef).
    6.  System moves user to **Profile Completion**.

---

## 4. Profile Completion (Checklist)

*   **Primary Actor:** Staff Member
*   **Description:** A mandatory list of tasks to complete before the profile can be submitted for review.
*   **Preconditions:** User is in the "Checklist" state.
*   **Main Flow:**
    1.  User views the list of outstanding items.
    2.  User uploads certificates (RSA, Hygiene).
    3.  User confirms possession of required Role Kit (Uniform, Tools).
    4.  User sets schedule availability.
    5.  User enters bank account details for payroll.
    6.  User fills out tax and wage forms.
    7.  Once all items are done, user submits for **Admin Verification**.

---

## 5. Admin Verification

*   **Primary Actor:** Staff Member (Passive) / Admin
*   **Description:** The waiting state while Krow admins review the submitted profile.
*   **Preconditions:** Profile submitted.
*   **Main Flow:**
    1.  User sees "Waiting for Admin Review" screen.
    2.  **Approved:** User status becomes "Active" and can access the **Main App**.
    3.  **Rejected:** User is sent back to **Profile Completion** to fix issues.

---

## 6. Main App Navigation

*   **Primary Actor:** Staff Member
*   **Description:** The central hub for accessing work and profile management.
*   **Preconditions:** User is logged in and verified.
*   **Main Flow:**
    1.  User views the Home Dashboard.
    2.  User navigates to:
        *   **Marketplace:** To find new work.
        *   **My Shifts:** To view upcoming schedule.
        *   **Earnings:** To track pay.
        *   **Profile:** To manage settings.

---

## 7. Shift Discovery (Marketplace)

*   **Primary Actor:** Staff Member
*   **Description:** Finding and accepting new work opportunities.
*   **Preconditions:** User is in the Marketplace tab.
*   **Main Flow:**
    1.  User browses available shifts.
    2.  User filters by date, location, or role.
    3.  User views shift details (pay, uniform requirements).
    4.  User applies for or accepts the shift.
    5.  Shift is added to **My Shifts**.

---

## 8. Pre-Shift Operations

*   **Primary Actor:** Staff Member
*   **Description:** Compliance steps to ensure readiness before the shift starts.
*   **Preconditions:** Shift is upcoming.
*   **Main Flow:**
    1.  User views "My Shifts".
    2.  User selects the active/upcoming shift.
    3.  User completes the "Pre-Shift Checklist" (Uniform check, etc.).
    4.  User confirms attendance.

---

## 9. Live Operations

*   **Primary Actor:** Staff Member
*   **Description:** The on-site workflow for tracking hours.
*   **Preconditions:** User is at the venue.
*   **Main Flow:**
    1.  User arrives at the venue.
    2.  User taps **Clock In** and scans Supervisor's QR/NFC.
    3.  Shift enters "In Progress" state.
    4.  When finished, user taps **Clock Out** and scans QR/NFC.
    5.  User reports any issues or breaks.

---

## 10. Post-Shift Finance

*   **Primary Actor:** Staff Member
*   **Description:** Tracking the financial outcome of completed work.
*   **Preconditions:** Shift is completed.
*   **Main Flow:**
    1.  User navigates to "Earnings".
    2.  User views "Earnings Summary" (Total Earned).
    3.  User views "History" to see individual shift pay.
    4.  User checks payment status (Processing, Paid).

---

## 11. Profile Management

*   **Primary Actor:** Staff Member
*   **Description:** Maintaining account details and getting help.
*   **Preconditions:** User is in Profile tab.
*   **Main Flow:**
    1.  User views profile details.
    2.  User updates Skills or Certificates.
    3.  User changes Availability.
    4.  User updates Bank Details.
    5.  User accesses **Support** for help.

---

# Use Case Diagram
```mermaid
flowchart TD
       subgraph AppInitialization [App Initialization]
           A[Start App] --> B{Check Auth Status}
           B -- Authenticated --> C[Go to Home]
           B -- Unauthenticated --> D[Go to Auth]
           B -- "Admin Validation" --> E[Go to Waiting Validation]
           B -- "Prepare Profile" --> F[Go to Checklist]
       end

       subgraph UserAuthentication [User Authentication]
           D --> G[Welcome Screen]
           G --> H{Select Sign In/Up}
           H -- "Sign In" --> I[Sign In With Email]
           I --> J[Verify Email Code]
           J -- Success --> C
           H -- "Sign Up" --> K[Go to User Onboarding]
       end

       subgraph UserOnboarding [User Onboarding]
           K --> L[Collect Personal Info]
           L --> M[Verify Email]
           M --> N[Add Emergency Contacts]
           N --> O[Enter Address]
           O --> P[Define Working Area]
           P --> Q[Select Role & Skills]
           Q -- Success --> F
       end

       subgraph ProfileCompletion [Profile Completion]
           F --> R[View Checklist]
           R --> S[Complete Personal Info]
           R --> T[Upload Certificates]
           R --> U[Manage Role Kit/Tools]
           R --> V[Set Schedule Availability]
           R --> W[Manage Bank Account]
           R --> X[Fill Out Tax/Wage Forms]
           X -- "All Complete" --> E
       end
       
       subgraph AdminVerification [Admin Verification]
           E --> Y[Waiting for Admin Review]
           Y -- Approved --> C
           Y -- Rejected --> F
       end

       subgraph MainApp [Main Application Shell]
           C --> Z[Home Dashboard]
           Z --> AA{Navigate}
           AA -- Marketplace --> AB[Job Marketplace]
           AA -- "My Shifts" --> AC[Schedule & Shifts]
           AA -- Earnings --> AD[Earnings & History]
           AA -- Profile --> AE[Profile Management]
       end

       subgraph ShiftDiscovery [Shift Discovery]
           AB --> AF[Browse Available Shifts]
           AF --> AG[Filter by Date/Location]
           AF --> AH[View Shift Details]
           AH --> AI[Apply/Accept Shift]
           AI --> AC
       end

       subgraph PreShiftOps [Pre-Shift Operations]
           AC --> AJ[View Upcoming Shifts]
           AJ --> AK[Select Active Shift]
           AK --> AL[Complete Compliance Checklist]
           AL --> AM[Verify Uniform & Tools]
           AM --> AN[Confirm Attendance]
       end

       subgraph LiveOperations [Live Operations]
           AN --> AO[Arrive at Venue]
           AO --> AP["Clock In (QR/NFC)"]
           AP --> AQ[Shift In Progress]
           AQ --> AR["Clock Out (QR/NFC)"]
           AR --> AS[Report Issues/Breaks]
       end

       subgraph PostShiftFinance [Post-Shift Finance]
           AD --> AT[View Earnings Summary]
           AT --> AU[View Earnings History]
           AU --> AV[Check Payment Status]
           AS --> AT
       end

       subgraph ProfileManagement [Profile Management]
           AE --> AW[View Profile]
           AW --> AX[Manage Skills & Certificates]
           AW --> AY[Update Availability]
           AW --> AZ[Manage Bank Details]
           AW --> BA[Access Support]
           BA --> BB["Contact Support/FAQ"]
       end
```
