# Phase 1: Foundation (V1/V2 Split)

## Objective

Migrate the current Filament admin to a V1 namespace, initialize V2 namespaces, and keep production behavior unchanged.

---

## Tasks

### 1.1 Move Filament code to V1 namespace

- Move:
  - `app/Filament/Resources/*` -> `app/Filament/V1/Resources/*`
  - `app/Filament/Pages/*` -> `app/Filament/V1/Pages/*`
  - `app/Filament/Widgets/*` -> `app/Filament/V1/Widgets/*`
  - `app/Filament/Components/*` -> `app/Filament/V1/Components/*`
  - `app/Filament/Concerns/*` -> `app/Filament/V1/Concerns/*`
- Update all namespaces/imports to `App\Filament\V1\...`.

### 1.2 Initialize V2 structure

Create:
- `app/Filament/V2/Pages/`
- `app/Filament/V2/Resources/`
- `app/Filament/V2/Widgets/`
- `app/Actions/AdminV2/`
- `app/Data/AdminV2/`

### 1.3 Update Filament discovery and registration

- Point `config/filament.php` discovery to V1 namespaces.
- Add explicit V2 page registration for a first landing page at `/admin/v2`.

### 1.4 Add V2 access gate

- Restrict V2 to `super_admin` and `manager`.
- Keep V1 behavior unchanged for all existing roles.

### 1.5 Add feature flag

- Add `features.admin_v2` config key.
- Ensure V2 routes/pages can be disabled safely.

---

## File Impact (Expected)

- `config/filament.php`
- `app/Providers/FilamentServiceProvider.php`
- `config/features.php` (or equivalent)
- all moved Filament classes (namespace updates)
- initial V2 landing page class + view

---

## Acceptance Criteria

- Existing `/admin/*` routes and pages work exactly as before.
- V2 is reachable at `/admin/v2` when feature flag is enabled.
- V2 returns forbidden for non-`super_admin`/`manager` users.
- Namespace migration introduces no route-name collisions.

---

## Tests

- V1 regression smoke tests for key resources/pages.
- Access tests on `/admin/v2` for allowed/denied roles.
- Boot tests ensuring Filament discovery is valid.
