📋 UC08: Arranged Status

USE CASE UC08: "ARRANGED" STATUS OF A REQUEST

This document explains how the "arranged" status of

care requests works and who can modify it.

The terms "ARRANGED" and "PLANNED" are SYNONYMS.

There is NO difference between these two terms.

In the application, only one status exists: "arranged".

1. Understanding Statuses

IMPORTANT: There is NO explicit "status" enum in the code.

The status is determined by the combination of several fields.

Fields Used

A) active (bool):

B) arrangedForPatient (bool?):

C) arrangedForCareGiver (Map):

Terminology

The terms "arranged" and "planned" are SYNONYMS - there is no difference.

In the code: arrangedForPatient = true means care is organized.

2. Possible Request States

File: lib/core/presentation/controllers/request_card_controller.dart

1. IN PROGRESS (Ongoing):

-> The request was just created, waiting for response

2. Arranged:

-> A caregiver has been found, care is scheduled

3. Cancelled:

-> The request was cancelled before being arranged

4. Completed:

-> Care has been provided and is finished

3. Who Can Mark A Request As "Arranged"?

A) THE PATIENT (or the person who created the request)

USE CASE:

ACTION:

Source Code

lib/modules/home/presentation/controllers/request_detail_screen_controller.dart

```dart

Future markAsArranged({

required String uuid,

bool? arrangedForPatient,

Map? arrangedForCareGiver,

}) async {

// ...

if (arrangedForCareGiver == null) {

// Patient marking as arranged

await arrangedRepo.call(requestId: uuid, arrangedForPatient: true);

// ...

B) THE NURSE (Caregiver)

USE CASE:

ACTION:

Source Code

```dart

if (arrangedForCareGiver != null) {

await arrangedRepo.call(

requestId: uuid,

arrangedForCareGiver: arrangedForCareGiver,

// ...

Important Difference

4. Conditions For Marking As "Arranged"

For The Patient

For The Nurse

5. Visible Changes For Users

WHEN THE PATIENT MARKS AS "ARRANGED":

For the patient:

For nurses:

(depending on defined business rules)

WHEN THE NURSE MARKS AS "ARRANGED":

For the nurse:

For the patient:

6. Cancelling An Arrangement

The Patient Can

The Nurse Can

Source Code

lib/modules/home/presentation/controllers/request_detail_screen_controller.dart

7. Complete Use Case: Lifecycle

1. CREATION (Patient)

-> Status: IN PROGRESS

2. NURSE ARRANGES (optional)

-> The nurse has arranged on their side

-> The patient has not yet confirmed

3. Patient Confirms

-> Status: ARRANGED

4. CARE COMPLETED (eventually)

-> Status: COMPLETED

Or Cancellation

3bis. PATIENT CANCELS

-> Status: CANCELLED

8. Technical References

Entity:

Use Case:

Controllers:

Repository:

Providers: