# ALG 1 Calculator - Region & Employment Months Verification

**Last Updated:** 2025-12-30

## Summary

After comprehensive testing and code review, both behaviors are **correct**:

1. **Region**: Only affects ALG 1 amount when base ALG exceeds the regional cap
2. **Beschäftigungsmonate**: Only affects duration, not amount (correct per SGB III §127)

## Region Impact Analysis

### How Region Affects Calculation

Region determines the **maximum cap (Höchstbetrag)** for ALG 1:

- **Westdeutschland**: 2.390 €/Monat
- **Ostdeutschland**: 2.320 €/Monat

### When Region Matters

Region **only affects the result** when:

- Base ALG 1 > Regional Maximum Cap

### Test Cases

| Income | Netto | Percentage | Base ALG | West Result | East Result | Region Affects?            |
| ------ | ----- | ---------- | -------- | ----------- | ----------- | -------------------------- |
| 2000€  | 2000€ | 60%        | 1200€    | 1200€       | 1200€       | ❌ No (below both caps)    |
| 4000€  | 4000€ | 60%        | 2400€    | 2390€       | 2320€       | ✅ Yes (70€ difference)    |
| 3983€  | 3983€ | 60%        | 2389.80€ | 2389.80€    | 2320€       | ✅ Yes (69.80€ difference) |
| 3000€  | 3000€ | 67%        | 2010€    | 2010€       | 2010€       | ❌ No (below both caps)    |
| 4000€  | 4000€ | 67%        | 2680€    | 2390€       | 2320€       | ✅ Yes (70€ difference)    |

### Implementation

```javascript
// Line 408: Region determines max ALG
const maxALG = this.region === "west" ? this.maxALGWest : this.maxALGEast;

// Line 410-411: Cap applied if base ALG exceeds max
if (baseALG > maxALG) {
  baseALG = maxALG;
}

// Line 360-364: Region watcher triggers recalculation
this.$watch("region", () => {
  if (this.incomeAmount && this.age) {
    this.debouncedCalculate();
  }
});
```

### UI Improvement

**Changed**: Höchstbetrag card now **always visible** (not just when capped) so users can see:

- Regional maximum cap value
- Whether their result is capped ("(erreicht)" indicator)
- Visual difference: Blue icon when not capped, Red icon when capped

## Employment Months Impact Analysis

### How Employment Months Affects Calculation

Employment months **ONLY affects duration**, not amount (SGB III §127).

### Duration Formula

```
Base Duration = min(floor(employmentMonths / 2), 12)
Age Increase = (age >= 50) ? min((age - 50) * 2, 12) : 0
Final Duration = min(Base Duration + Age Increase, 24)
```

### Test Cases

| Employment Months | Age | Base Duration | Age Increase | Final Duration |
| ----------------- | --- | ------------- | ------------ | -------------- |
| 12                | 35  | 6             | 0            | 6              |
| 18                | 35  | 9             | 0            | 9              |
| 24                | 35  | 12            | 0            | 12             |
| 24                | 50  | 12            | 0            | 12             |
| 24                | 55  | 12            | 10           | 22             |
| 24                | 58  | 12            | 12           | 24             |
| 20                | 45  | 10            | 0            | 10             |

### Implementation

```javascript
// Lines 427-435: Employment months affects duration only
if (employmentMonthsValue >= 12) {
  durationMonths = Math.min(Math.floor(employmentMonthsValue / 2), 12);
  if (ageValue >= 50) {
    const ageIncrease = Math.min((ageValue - 50) * 2, 12);
    durationMonths = Math.min(durationMonths + ageIncrease, 24);
  }
}

// Lines 345-349: Employment months watcher triggers recalculation
this.$watch("employmentMonths", () => {
  if (this.incomeAmount && this.age) {
    this.debouncedCalculate();
  }
});
```

### Legal Basis

**SGB III §127** states that duration depends on:

1. Employment months in last 2 years (base duration)
2. Age (additional months for 50+)

Employment months **does NOT** affect the ALG 1 amount calculation, only duration.

## Verification Results

### Region Impact

- ✅ Code correctly uses region to determine max ALG cap
- ✅ Watcher triggers recalculation on region change
- ✅ Max ALG value stored in `calculationBreakdown.maxALG`
- ✅ Höchstbetrag card displays regional maximum
- ✅ Card now always visible (improved UX)

### Employment Months Impact

- ✅ Code correctly uses employment months for duration only
- ✅ Watcher triggers recalculation on employment months change
- ✅ Duration calculation matches legal requirements (SGB III §127)
- ✅ Employment months does NOT affect amount (correct)

## Testing Recommendations

To verify region impact:

1. Enter high income (e.g., 5000€ netto)
2. Switch between West and East
3. Verify ALG 1 amount changes (70€ difference when capped)

To verify employment months impact:

1. Enter income and age
2. Change employment months (12, 18, 24)
3. Verify only duration changes, not amount

## Conclusion

Both behaviors are **correct**:

- **Region**: Only affects amount when base ALG exceeds regional cap (expected behavior)
- **Beschäftigungsmonate**: Only affects duration, not amount (legally correct)

The implementation matches legal requirements and expected behavior.
