> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Braian551/viax/llms.txt
> Use this file to discover all available pages before exploring further.

# Driver Vehicle

> Manage driver vehicle information and documents

## Update Vehicle Information

```
POST /conductor/update_vehicle.php
```

Update vehicle information for a driver.

### Request Body

<ParamField body="conductor_id" type="integer" required>
  Driver ID
</ParamField>

<ParamField body="vehiculo_marca" type="string">
  Vehicle brand/make (e.g., "Yamaha", "Honda")
</ParamField>

<ParamField body="vehiculo_modelo" type="string">
  Vehicle model (e.g., "FZ-16", "CBR250")
</ParamField>

<ParamField body="vehiculo_anio" type="integer">
  Manufacturing year
</ParamField>

<ParamField body="vehiculo_placa" type="string">
  License plate number (Colombian format)
</ParamField>

<ParamField body="vehiculo_color" type="string">
  Vehicle color
</ParamField>

<ParamField body="vehiculo_tipo" type="string">
  Vehicle type: `moto`, `auto`, or `mototaxi`
</ParamField>

<ParamField body="empresa_id" type="integer">
  Transport company ID (for company-affiliated drivers)
</ParamField>

<ParamField body="soat_numero" type="string">
  SOAT insurance number
</ParamField>

<ParamField body="soat_vencimiento" type="string">
  SOAT expiration date (ISO 8601)
</ParamField>

<ParamField body="tecnomecanica_numero" type="string">
  Tecnomecánica certificate number
</ParamField>

<ParamField body="tecnomecanica_vencimiento" type="string">
  Tecnomecánica expiration date (ISO 8601)
</ParamField>

<ParamField body="tarjeta_propiedad_numero" type="string">
  Vehicle ownership card number
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Update success status
</ResponseField>

<ResponseField name="message" type="string">
  Success message
</ResponseField>

<ResponseField name="vehicle" type="object">
  Updated vehicle data
</ResponseField>

### Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://76.13.114.194/conductor/update_vehicle.php \
    -H "Content-Type: application/json" \
    -d '{
      "conductor_id": 25,
      "vehiculo_marca": "Yamaha",
      "vehiculo_modelo": "FZ-16",
      "vehiculo_anio": 2022,
      "vehiculo_placa": "ABC123",
      "vehiculo_color": "Negro",
      "vehiculo_tipo": "moto",
      "soat_numero": "SOAT123456",
      "soat_vencimiento": "2025-12-31",
      "tecnomecanica_numero": "TM789012",
      "tecnomecanica_vencimiento": "2025-06-30",
      "tarjeta_propiedad_numero": "TP345678"
    }'
  ```

  ```dart Dart theme={null}
  await http.post(
    Uri.parse('https://76.13.114.194/conductor/update_vehicle.php'),
    headers: {'Content-Type': 'application/json'},
    body: jsonEncode({
      'conductor_id': 25,
      'vehiculo_marca': 'Yamaha',
      'vehiculo_modelo': 'FZ-16',
      'vehiculo_anio': 2022,
      'vehiculo_placa': 'ABC123',
      'vehiculo_color': 'Negro',
      'vehiculo_tipo': 'moto',
      'soat_numero': 'SOAT123456',
      'soat_vencimiento': '2025-12-31T23:59:59.000Z',
      'tecnomecanica_numero': 'TM789012',
      'tecnomecanica_vencimiento': '2025-06-30T23:59:59.000Z',
      'tarjeta_propiedad_numero': 'TP345678',
    }),
  );
  ```
</CodeGroup>

### Response Example

```json Success theme={null}
{
  "success": true,
  "message": "Vehículo actualizado exitosamente",
  "vehicle": {
    "marca": "Yamaha",
    "modelo": "FZ-16",
    "anio": 2022,
    "placa": "ABC123",
    "color": "Negro",
    "tipo": "moto",
    "soat_numero": "SOAT123456",
    "soat_vencimiento": "2025-12-31T23:59:59.000Z",
    "tecnomecanica_numero": "TM789012",
    "tecnomecanica_vencimiento": "2025-06-30T23:59:59.000Z",
    "tarjeta_propiedad_numero": "TP345678"
  }
}
```

***

## Vehicle Types

Viax supports three vehicle types:

<CardGroup cols={3}>
  <Card title="Moto" icon="motorcycle">
    Standard motorcycles for single passenger
  </Card>

  <Card title="Auto" icon="car">
    Cars for multiple passengers
  </Card>

  <Card title="Mototaxi" icon="van-shuttle">
    Motorcycle taxis with passenger cabin
  </Card>
</CardGroup>

### Vehicle Type Enum

```dart theme={null}
enum VehicleType {
  moto('moto', 'Moto'),
  auto('auto', 'Auto'),
  mototaxi('mototaxi', 'Mototaxi');
  
  final String value;
  final String label;
  
  const VehicleType(this.value, this.label);
}
```

***

## License Plate Format

Colombian license plates follow specific formats:

* **Standard Format**: `ABC123` (3 letters + 3 numbers)
* **Motorcycles**: May use 6 characters alphanumeric

### Plate Normalization

The API normalizes license plates to uppercase without spaces:

```dart theme={null}
String normalizePlate(String plate) {
  return plate.toUpperCase().replaceAll(RegExp(r'[^A-Z0-9]'), '');
}

// Example:
normalizePlate('abc-123')  // Returns: 'ABC123'
normalizePlate('abc 123')  // Returns: 'ABC123'
```

***

## Required Documents

For vehicle registration in Colombia, drivers must provide:

<Steps>
  <Step title="SOAT">
    Mandatory traffic accident insurance (Seguro Obligatorio de Accidentes de Tránsito)
  </Step>

  <Step title="Tecnomecánica">
    Technical-mechanical inspection certificate
  </Step>

  <Step title="Tarjeta de Propiedad">
    Vehicle ownership card
  </Step>

  <Step title="Vehicle Photos">
    Photos of the vehicle (front, side, interior)
  </Step>
</Steps>

***

## Document Expiration Validation

<Warning>
  **Important:** SOAT and Tecnomecánica must be valid (not expired) for the driver to be approved and remain active.
</Warning>

### Check Document Validity

```dart theme={null}
bool isDocumentValid(DateTime? expirationDate) {
  if (expirationDate == null) return false;
  return DateTime.now().isBefore(expirationDate);
}

bool isSOATExpiringSoon(DateTime? expirationDate) {
  if (expirationDate == null) return true;
  final warningDate = DateTime.now().add(Duration(days: 30));
  return expirationDate.isBefore(warningDate);
}
```

***

## Completeness Check

The vehicle model includes helper methods to check if all required information is complete:

```dart theme={null}
class VehicleModel {
  // Check if basic vehicle info is complete
  bool get isBasicComplete {
    return placa.isNotEmpty &&
        marca != null && marca!.isNotEmpty &&
        modelo != null && modelo!.isNotEmpty &&
        anio != null &&
        color != null && color!.isNotEmpty;
  }
  
  // Check if all documents are complete
  bool get isDocumentsComplete {
    return soatNumero != null && soatNumero!.isNotEmpty &&
        soatVencimiento != null &&
        tecnomecanicaNumero != null && tecnomecanicaNumero!.isNotEmpty &&
        tecnomecanicaVencimiento != null &&
        tarjetaPropiedadNumero != null && tarjetaPropiedadNumero!.isNotEmpty;
  }
  
  // Check if all required photos are uploaded
  bool get isPhotosComplete {
    return fotoVehiculo != null && fotoVehiculo!.isNotEmpty &&
        fotoTarjetaPropiedad != null && fotoTarjetaPropiedad!.isNotEmpty &&
        fotoSoat != null && fotoSoat!.isNotEmpty &&
        fotoTecnomecanica != null && fotoTecnomecanica!.isNotEmpty;
  }
}
```

## Error Responses

<ResponseField name="400" type="Bad Request">
  Invalid vehicle data or expired documents
</ResponseField>

<ResponseField name="404" type="Not Found">
  Driver not found
</ResponseField>

<ResponseField name="500" type="Internal Server Error">
  Server error during update
</ResponseField>

## See Also

* [Driver Profile](/api/drivers/profile) - Manage driver profile
* [Driver Documents](/api/drivers/documents) - Upload driver documents
