# 🧪 License Test Seeders

## Overview
These seeders create all the necessary data to test license creation functionality.

## Seeders Created

### 1. **AppModuleSeeder**
- Creates app modules: CRM, HR, Accounting, Projects, Inventory
- Basic module types that can be assigned to applications

### 2. **OfferTypeSeeder**
- Creates offer types: Starter, Professional, Enterprise
- Defines the tier levels for offers

### 3. **ApplicationModuleSeeder**
- Links AppModules to a test Application
- Creates ApplicationModule records for each app module

### 4. **OfferSeeder**
- Creates 3 offers based on OfferTypes with specific options:
  - **Starter Plan**: 5 users, 10GB storage, email support
  - **Professional Plan**: 20 users, 100GB storage, phone support, API access
  - **Enterprise Plan**: Unlimited everything, 24/7 support

### 5. **OfferApplicationModuleSeeder**
- Links Offers to ApplicationModules with pricing:
  - **Starter**: CRM(50), HR(30), Accounting(40)
  - **Professional**: CRM(150), HR(100), Accounting(120), Projects(80), Inventory(90)
  - **Enterprise**: CRM(400), HR(300), Accounting(350), Projects(250), Inventory(280)

### 6. **LicenseTestSeeder** (Main orchestrator)
- Runs all seeders in the correct order
- Ensures all dependencies are met

## Usage

### Run all license test seeders at once:
```bash
php artisan db:seed --class=LicenseTestSeeder --tenants=netbyus
```

### Run individual seeders (if needed):
```bash
php artisan db:seed --class=AppModuleSeeder --tenants=netbyus
php artisan db:seed --class=OfferTypeSeeder --tenants=netbyus
php artisan db:seed --class=ApplicationModuleSeeder --tenants=netbyus
php artisan db:seed --class=OfferSeeder --tenants=netbyus
php artisan db:seed --class=OfferApplicationModuleSeeder --tenants=netbyus
```

## Testing License Creation

After running the seeders, you can test license creation with this data:

### Example POST request:
```json
{
  "license_type_id": "your-license-type-uuid",
  "offer_id": "uuid-of-starter-plan", 
  "contact_id": "uuid-of-contact",
  "contact_type": "App\\Models\\Contact",
  "name": "Test License",
  "price": 99.99,
  "duration": 365
}
```

## ID Linking

All seeders use `firstOrCreate` to ensure:
- ✅ No duplicate data
- ✅ Proper relationships are maintained
- ✅ Safe to run multiple times
- ✅ No ID conflicts between seeder runs

## Data Flow

```
AppModule
    ↓
ApplicationModule (links App to AppModule)
    ↓
Offer (linked to OfferType)
    ↓
OfferApplicationModule (links Offer to ApplicationModule with price)
    ↓
License (can be created from Offer)
```
