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

# Groups

> EcoMail Hub users define target groups of creditor profiles for campaigns.

## Real-World Example

Maya wants to email all pending creditor members that still have pending notice responses. She creates a group, chooses that creditor profile state, chooses whether to send to company email, contacts, or both, and previews the group size before saving.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["User creates group"] --> B["Choose creditor profile state"]
    B --> C["Choose send-to recipient type"]
    C --> D["Portal calculates group size"]
    D --> E{"Profiles found?"}
    E -->|No| F["Group would send to nobody"]
    E -->|Yes| G["Save group for campaigns"]
    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,D system;
    class E decision;
    class F risk;
    class G outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## Group Criteria

Groups can target active members, pending members, YouNegotiate prospects, consumer prospects, and profiles tied to YouNegotiate-closed offers. Some options narrow the group to profiles with pending notice responses.

## Group Actions

| Action               | Expected Behavior                                               |
| -------------------- | --------------------------------------------------------------- |
| Create/Edit group    | Saves the group criteria for the logged-in EcoMail Hub user.    |
| Calculate group size | Counts matching creditor profiles from the selected state rule. |
| View group size      | Shows total profiles currently matching a saved group.          |
| Delete               | Removes only an owned group.                                    |

## How It Should Work

* It should require group name, creditor profile state, and send-to type.
* It should keep group names unique for the logged-in EcoMail Hub user.
* It should calculate group size before or after saving so users know campaign reach.
* It should support company email only, contact emails only, or both.

## How It Should Not Work

* It should not let one EcoMail Hub user edit or delete another user's group.
* It should not create a campaign group without a recipient type.
* It should not hide that a group has zero matching profiles.

## Developer Notes

* Group membership is calculated dynamically from creditor profile state rules.
* The saved group stores criteria, not a permanent snapshot of profiles.

## Related App Areas

* `app/Livewire/ConsumerResponseManager/Communications/Group/IndexPage.php`
* `app/Livewire/ConsumerResponseManager/Communications/Group/ListView.php`
* `app/Livewire/ConsumerResponseManager/Forms/Communications/EcoMailHubGroupForm.php`
* `app/Enums/CreditorProfileState.php`
* `app/Enums/SendToType.php`
