# Package Structure Restructure Plan

## Current Problem
- Fixed pricing model doesn't match real business needs
- All services forced through same workflow
- No distinction between feasibility-dependent and custom services

## Proposed Solution

### 1. Service Categories

#### Category A: Feasibility-Based Services (Location Dependent)
- **Magellan Metro-VPN**: High-speed networking within same city
- **Shared Business Broadband**: Cost-effective general business connectivity
- **Dedicated Burst Internet**: Guaranteed base bandwidth with burst capability

**Workflow**: Location Check → Feasibility Assessment → Dynamic Pricing → Quotation → Approval → Order

#### Category B: Custom Enterprise Services (Location Independent)
- **Dedicated Internet Access**: Guaranteed uncontended connection
- **Dark Fibre Lease**: Passive fibre infrastructure
- **International Private Line Circuit**: Cross-country VPN
- **InterCity-VPN**: Cross-city networking

**Workflow**: Requirements Gathering → Custom Quotation → Negotiation → Approval → Order

### 2. New Package Structure

```sql
-- Enhanced product_packages table
ALTER TABLE product_packages ADD COLUMN service_category ENUM('feasibility_based', 'custom_enterprise') DEFAULT 'feasibility_based';
ALTER TABLE product_packages ADD COLUMN requires_feasibility_check BOOLEAN DEFAULT true;
ALTER TABLE product_packages ADD COLUMN has_fixed_pricing BOOLEAN DEFAULT false;
ALTER TABLE product_packages ADD COLUMN base_price DECIMAL(10,2) NULL; -- Starting price for estimates
ALTER TABLE product_packages ADD COLUMN pricing_model ENUM('fixed', 'distance_based', 'custom', 'bandwidth_based') DEFAULT 'custom';
ALTER TABLE product_packages ADD COLUMN requires_site_survey BOOLEAN DEFAULT true;
ALTER TABLE product_packages ADD COLUMN min_contract_months INT DEFAULT 12;
ALTER TABLE product_packages ADD COLUMN setup_fee_type ENUM('fixed', 'calculated', 'custom') DEFAULT 'custom';
```

### 3. Workflow Logic

#### For Feasibility-Based Services:
1. **Service Selection** → Customer selects from Category A services
2. **Location Input** → Customer provides service address
3. **Feasibility Check** → System calculates:
   - Distance to nearest infrastructure
   - Extension costs
   - Installation complexity
4. **Dynamic Pricing** → System generates pricing based on:
   - Base service cost
   - Distance-based extension fees
   - Installation complexity
   - Equipment requirements
5. **Quotation Generation** → All services go through quotation process
6. **Customer Approval** → Customer reviews and accepts quotation
7. **Payment Processing** → Customer pays based on approved quotation

#### For Custom Enterprise Services:
1. **Service Selection** → Customer selects from Category B services
2. **Requirements Gathering** → Detailed form for:
   - Bandwidth requirements
   - Locations (start/end points)
   - SLA requirements
   - Special requirements
3. **Sales Team Review** → Manual review and pricing
4. **Custom Quotation** → Sales team creates custom quotation
5. **Negotiation Phase** → Back-and-forth with customer
6. **Final Approval** → Customer accepts final terms
7. **Payment Processing** → Based on agreed terms

### 4. Pricing Models

#### Distance-Based Pricing (Feasibility Services)
```php
// Example for Magellan Metro-VPN
$basePrice = 500; // Monthly base price
$setupFee = 1000; // Base setup fee
$extensionCostPerKm = 2000; // Cost per km of fibre extension
$equipmentCost = 5000; // Router/equipment cost

$totalSetup = $setupFee + ($distance * $extensionCostPerKm) + $equipmentCost;
$monthlyFee = $basePrice;
```

#### Bandwidth-Based Pricing (DIA)
```php
// Example for Dedicated Internet Access
$pricePerMbps = 50; // Per Mbps monthly
$setupFeePerMbps = 100; // Per Mbps setup
$minimumBandwidth = 10; // Minimum 10 Mbps

$monthlyFee = $bandwidth * $pricePerMbps;
$setupFee = $bandwidth * $setupFeePerMbps;
```

### 5. Implementation Steps

#### Step 1: Update Database Schema
- Modify product_packages table
- Add service categories
- Add pricing model fields

#### Step 2: Update Package Data
- Replace current packages with real services
- Set appropriate categories and pricing models
- Configure feasibility requirements

#### Step 3: Update Controllers
- Modify QuotationController for dynamic pricing
- Add custom quotation workflow
- Update feasibility logic

#### Step 4: Update Frontend Logic
- Different workflows for different service categories
- Dynamic forms based on service type
- Pricing calculators for feasibility-based services

### 6. Quotation Process for All Services

**Key Change**: ALL services now go through quotation process, but with different pricing mechanisms:

- **Feasibility-Based**: Auto-calculated quotations based on location and requirements
- **Custom Enterprise**: Manual quotations created by sales team

This ensures:
- Consistent workflow
- Proper approval process
- Accurate pricing for all service types
- Better customer experience

### 7. High Feasibility Handling

For high feasibility locations (close to existing infrastructure):
1. **Instant Quotation**: System can generate immediate quotation
2. **Simplified Approval**: Faster approval process
3. **Express Installation**: Shorter lead times
4. **Standard Pricing**: Predictable costs

But still maintains quotation workflow for:
- Audit trail
- Customer approval
- Payment processing
- Order management