# API Error Codes

This document defines the error codes used in the Licenses Manager for WooCommerce API.

## Error Code Ranges

| Range    | Category                       |
|----------|----------------------------------|
| 1000-1999 | Data Validation                 |
| 2000-2999 | Authentication and Authorization |
| 3000-3999 | Business Logic                  |
| 4000-4999 | External or Infrastructure Errors |
| 9000-9999 | Unexpected Errors               |

## Specific Codes

### Data Validation (1000-1999)
| Code | Description                                      | Status |
|--------|--------------------------------------------------|---------| 
| 1001   | Required parameter missing or empty              | ✅ Implemented |
| 1002   | Invalid data format                              | ⚠️ Defined but not implemented |
| 1003   | Value out of range                               | ⚠️ Defined but not implemented |

### Authentication and Authorization (2000-2999)
| Code | Description                                      | Status |
|--------|--------------------------------------------------|---------| 
| 2001   | Invalid secret key                               | ✅ Implemented |
| 2002   | Invalid license key                              | ⚠️ Defined but not implemented |
| 2003   | Insufficient permissions for this operation      | ✅ Implemented |
| 2004   | Token expired                                    | ⚠️ Defined but not implemented |

### Business Logic (3000-3999)
| Code | Description                                      | Status |
|--------|--------------------------------------------------|---------| 
| 3000   | Order not found or invalid status                | ✅ Implemented |
| 3001   | License not found                                | ✅ Implemented |
| 3002   | Activation not found                             | ⚠️ Defined but not implemented |
| 3003   | Activation limit reached                         | ✅ Implemented |
| 3004   | License expired                                  | ⚠️ Defined but not implemented |
| 3005   | License already deleted                          | ⚠️ Defined but not implemented |
| 3006   | License already activated on this site           | ⚠️ Defined but not implemented |
| 3007   | Product not found                                | ✅ Implemented |
| 3008   | Download file not found                          | ⚠️ Defined but not implemented |

### External or Infrastructure Errors (4000-4999)
| Code | Description                                      | Status |
|--------|--------------------------------------------------|---------| 
| 4001   | Database error                                   | ✅ Implemented |
| 4002   | External service error                           | ⚠️ Defined but not implemented |
| 4003   | Filesystem error                                 | ⚠️ Defined but not implemented |

### Unexpected Errors (9000-9999)
| Code | Description                                      | Status |
|--------|--------------------------------------------------|---------| 
| 9001   | Internal server error                            | ⚠️ Defined but not implemented |