> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sub Accounts

> ABC Collections has two business units: Medical Collections and Retail Collections.

## Real-World Example

ABC Collections has two business units: Medical Collections and Retail Collections. Each unit should have its own sub-account so consumers, imports, users, and reports stay organized.

A parent account user should be able to review allowed activity across both sub-accounts, while a sub-account user should only see the records they are allowed to access.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Parent creditor creates sub-accounts"] --> B["Consumers are assigned to sub-accounts"]
    B --> C["Sub-account user logs in"]
    C --> D["User sees allowed sub-account records"]
    B --> E["Parent user logs in"]
    E --> F["Parent sees allowed combined or filtered records"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,C,E system;
    class D,F outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should allow the creditor to manage sub-account records.
* Consumers, imports, reports, and users should remain connected to the correct sub-account when applicable.
* Parent account users should be able to see the correct combined or filtered view based on access.

## How It Should Not Work

* It should not mix data between unrelated sub-accounts.
* It should not let a sub-account user access records outside their allowed scope.
* It should not break reports or imports that depend on sub-account assignment.

## Developer Notes

* Keep behavior scoped to the logged-in creditor company and allowed sub-accounts.
* When this page changes user-visible behavior, update the real-world example and visual flow.

## Related App Areas

* `routes/creditor/index.php`
