sequenceDiagram
    participant Client as 🏢 Client App
    participant Backend as 🌐 Backend API
    participant Admin as ⚙️ KROW Admin
    participant Staff as 👥 Staff App
    
    %% Event Creation
    Note over Client,Backend: 1. Event & Shift Creation
    Client->>Backend: Create Event with Shifts & Positions
    Backend-->>Client: Event Created (Draft)
    Client->>Backend: Publish Event
    Backend-->>Client: Event Published
    
    %% Staff Assignment
    Note over Admin,Backend: 2. Staff Assignment
    Admin->>Backend: View Available Events
    Backend-->>Admin: Event List
    Admin->>Backend: Assign Staff to Shift
    Backend-->>Admin: Assignment Confirmed
    Backend->>Staff: Notification: New Shift Assigned
    
    %% Shift Acceptance
    Note over Staff,Backend: 3. Shift Acceptance
    Staff->>Backend: View Shift Details
    Backend-->>Staff: Shift Information
    Staff->>Backend: Accept Shift
    Backend-->>Staff: Shift Confirmed
    Backend->>Client: Notification: Staff Confirmed
    
    %% Clock In
    Note over Client,Staff: 4. Clock In - Day of Event
    Client->>Client: Generate QR Code for Event
    Staff->>Staff: Scan QR Code
    Staff->>Backend: Clock In Request (via QR)
    Backend-->>Staff: Clock In Confirmed
    Backend->>Client: Notification: Staff Clocked In
    Client->>Backend: (Alternative) Manual Clock In
    Backend-->>Client: Manual Clock In Confirmed
    
    %% Shift Active
    Note over Staff: 5. Shift In Progress
    Staff->>Staff: View Real-time Timer
    
    %% Clock Out
    Note over Client,Staff: 6. Clock Out - End of Shift
    Staff->>Staff: Scan QR Code
    Staff->>Backend: Clock Out Request (via QR)
    Backend-->>Staff: Clock Out Confirmed
    Backend-->>Staff: Shift Status: Completed
    Backend->>Client: Notification: Staff Clocked Out
    
    %% Rating & Invoicing
    Note over Client,Backend: 7. Post-Shift Activities
    Client->>Backend: Rate Staff Performance
    Backend-->>Client: Rating Recorded
    Backend->>Backend: Generate Invoice
    Backend->>Client: Invoice Created
    Client->>Backend: Review & Approve Invoice
    Backend-->>Client: Invoice Approved
    
    %% Payment
    Note over Staff,Backend: 8. Staff Payment
    Backend->>Staff: Payment Processed
    Staff->>Backend: View Earnings & Payment History
    Backend-->>Staff: Payment Details
    
    alt Payment Dispute
        Staff->>Backend: Contest Payment Amount
        Backend-->>Staff: Dispute Opened
    end