graph TD
    subgraph User Authentication
        direction LR
        UA1[Flutter App] -->|Phone Number| UA2[Firebase Auth];
        UA2 -->|Verification Code| UA1;
        UA1 -->|Verification Code| UA2;
        UA2 -->|Auth Token| UA1;
        UA1 -->|Auth Token| UA3[GraphQL Server];
        UA3 -->|User Data| UA1;
    end

    subgraph User Onboarding
        direction LR
        UO1[Flutter App] -->|Personal Info| UO2[GraphQL Server];
        UO2 -->|update_staff_personal_info| UO3[Firebase Firestore];
        UO2 -->|User Data| UO1;
    end

    subgraph Shift Management
        direction LR
        SM1[Flutter App] -->|Get Shifts| SM2[GraphQL Server];
        SM2 -->|getShifts| SM3[Firebase Firestore];
        SM3 -->|Shift Data| SM2;
        SM2 -->|Shift Data| SM1;

        SM1 -->|Accept Shift| SM2;
        SM2 -->|accept_shift| SM3;
        SM3 -->|Updated Shift| SM2;
        SM2 -->|Updated Shift| SM1;
    end

    subgraph Profile Update with Avatar
        direction LR
        PU1[Flutter App] -->|Image| PU2[Firebase Storage];
        PU2 -->|Image URL| PU1;
        PU1 -->|Image URL & Personal Info| PU3[GraphQL Server];
        PU3 -->|update_staff_personal_info & upload_staff_avatar| PU4[Firebase Firestore];
        PU3 -->|User Data| PU1;
    end