# Test Agency Information

## ✅ Active Test Agency Created

### Agency Details

| Field | Value |
|-------|-------|
| **Agency ID** | `4129a396-8a2a-4e5d-8d25-500e47acc2bb` |
| **Name** | Test Travel Agency |
| **Matricule Number** | TEST001 |
| **Email** | test@agency.com |
| **Phone** | +34600000000 |
| **Status** | ACTIVE ✅ |
| **Verified** | Yes ✅ |
| **Subscription** | MONTHLY |
| **Markup** | 5.0% |
| **Wallet Balance** | 5000.00 EUR |

---

## 🚀 Use in Swagger UI

### Flight Search Endpoint

**Endpoint**: `POST /api/v1/flights/search`

#### Query Parameter (agencyId):
```
4129a396-8a2a-4e5d-8d25-500e47acc2bb
```

#### Request Body:
```json
{
  "origin": "MAD",
  "destination": "JFK",
  "departureDate": "2026-03-15",
  "returnDate": "2026-03-22",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "cabinClass": "ECONOMY"
}
```

---

## 📝 Complete Test Examples

### Example 1: Madrid to New York (Round Trip)
**agencyId**: `4129a396-8a2a-4e5d-8d25-500e47acc2bb`

```json
{
  "origin": "MAD",
  "destination": "JFK",
  "departureDate": "2026-03-15",
  "returnDate": "2026-03-22",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "cabinClass": "ECONOMY"
}
```

### Example 2: London to Dubai (Business Class)
**agencyId**: `4129a396-8a2a-4e5d-8d25-500e47acc2bb`

```json
{
  "origin": "LHR",
  "destination": "DXB",
  "departureDate": "2026-04-10",
  "returnDate": "2026-04-20",
  "adults": 2,
  "children": 0,
  "infants": 0,
  "cabinClass": "BUSINESS"
}
```

### Example 3: Paris to Barcelona (One Way)
**agencyId**: `4129a396-8a2a-4e5d-8d25-500e47acc2bb`

```json
{
  "origin": "CDG",
  "destination": "BCN",
  "departureDate": "2026-05-01",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "cabinClass": "ECONOMY"
}
```

---

## 🔍 Verify Agency in Database

```bash
docker-compose exec postgres psql -U flight_user -d flight_platform -c \
  "SELECT id, name, status, is_verified, markup_percentage FROM agencies WHERE id = '4129a396-8a2a-4e5d-8d25-500e47acc2bb';"
```

---

## 💰 Check Wallet Balance

```bash
docker-compose exec postgres psql -U flight_user -d flight_platform -c \
  "SELECT agency_id, balance, currency FROM wallets WHERE agency_id = '4129a396-8a2a-4e5d-8d25-500e47acc2bb';"
```

---

## 🎯 Quick Test in Swagger

1. **Open Swagger UI**: http://localhost:8081/swagger-ui.html

2. **Find Flight Search**: Scroll to "Flight Search" → POST `/api/v1/flights/search`

3. **Click**: "Try it out"

4. **Fill in**:
   - **agencyId**: `4129a396-8a2a-4e5d-8d25-500e47acc2bb`
   - **Request body**: Copy one of the examples above

5. **Click**: "Execute"

---

## 📊 Expected Response

```json
{
  "searchId": "search-abc123",
  "offers": [
    {
      "offerId": "offer-xyz789",
      "validatingCarrier": "AV",
      "price": {
        "baseFare": 266.66,
        "taxes": 50.00,
        "markup": 13.33,
        "total": 329.99,
        "currency": "EUR"
      },
      "outboundSegments": [
        {
          "departureAirport": "MAD",
          "arrivalAirport": "BOG",
          "departureTime": "2026-03-15T10:50:00",
          "arrivalTime": "2026-03-15T15:05:00",
          "carrierCode": "AV",
          "flightNumber": "183",
          "cabinClass": "ECONOMY"
        }
      ]
    }
  ]
}
```

**Note**: The `markup` field shows the 5% markup applied by the agency (5% of base fare + taxes).

---

## 🛠️ Create More Test Agencies

If you need more agencies, run:

```bash
./create-test-agency.sh
```

Or manually:

```sql
INSERT INTO agencies (
    name,
    matricule_number,
    contact_email,
    contact_phone,
    status,
    is_verified,
    subscription_type,
    subscription_start_date,
    markup_percentage
) VALUES (
    'Another Agency',
    'TEST002',
    'another@agency.com',
    '+34600000001',
    'ACTIVE',
    true,
    'MONTHLY',
    CURRENT_DATE,
    7.5
);
```

---

## ⚠️ Important Notes

1. **Authentication Required**: The flight search endpoint requires a JWT token. See `SWAGGER_TESTING_GUIDE.md` for authentication setup.

2. **Agency Must Be Active**: The agency status must be `ACTIVE` and `is_verified` must be `true`.

3. **Wallet Balance**: The agency has 5000 EUR in the wallet for testing bookings.

4. **Markup Applied**: All flight prices will include a 5% markup automatically.

---

## 🎉 Ready to Test!

Your test agency is ready. Use the agency ID above in Swagger UI to test flight searches!

**Agency ID**: `4129a396-8a2a-4e5d-8d25-500e47acc2bb`

---

**Created**: January 23, 2026
**Status**: ✅ ACTIVE
