> ## 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.

# Communication Groups

> Super Admin creates consumer-targeting groups by company scope, account status, and optional date rules for campaign selection.

## Real-World Example

Super Admin creates a group for all active consumers at one creditor company whose placement date falls within January 2026. That group can be selected later when scheduling a communication campaign.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Super Admin chooses company scope"] --> B["System applies consumer status"]
    B --> C["Optional placement or expiry date rules narrow the audience"]
    C --> D["System previews count and balance"]
    D --> E["Group is saved for campaign selection"]
    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 outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,C,D system;
    class E outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should list only groups owned by the authenticated Super Admin.
* It should support All companies or one company as the Apply To scope.
* It should calculate current group size from live consumer data.
* It should block creation when the selected rules match zero consumers.
* It should allow updates even when the updated rules currently match zero consumers, matching current portal behavior.
* It should export the current matching consumers as CSV.

## How It Should Not Work

* It should not expose groups owned by another Super Admin or another portal owner.
* It should not accept unknown custom rule keys.
* It should not store creditor-only subclient or upload-file filters for Super Admin groups.
* It should not include unnecessary owner fields in the API payload.

## Developer Notes

* Super Admin groups use the shared `groups` table with `owner_type = App\Models\SuperAdmin` and `owner_id` set to the authenticated Super Admin.
* `company_id = null` means All companies; a company ID scopes the consumer query to that company.
* `subclient_id` and `file_upload_history_id` remain null for Super Admin groups.

## Related App Areas

* `routes/superadmin.php`
* `app/Livewire/Creditor/Communications/Group`
