# vehicle data

## Overview

Vehicle data is stored in JSON files located in `data/dealers/` folder. Each dealer has its own JSON file with categories and vehicles.

## File Location

```
data/
└── dealers/
    ├── nova_imports.json
    └── another_dealer.json
```

{% hint style="info" %}
The JSON filename must match the dealer key in config (lowercase, spaces replaced with underscores).
{% endhint %}

## JSON Structure

```json
{
    "categories": [
        {
            "name": "Compacts",
            "vehicles": [
                {
                    "name": "Blista",
                    "spawnName": "blista",
                    "price": 400,
                    "stock": 7,
                    "productionYear": 2014,
                    "maxSpeed": 165,
                    "speed": 5,
                    "acceleration": 6,
                    "handling": 7,
                    "braking": 6
                }
            ]
        }
    ]
}
```

## Category Options

| Option   | Type   | Required | Description              |
| -------- | ------ | -------- | ------------------------ |
| name     | string | Yes      | Category display name    |
| vehicles | array  | Yes      | Array of vehicle objects |

## Vehicle Options

| Option         | Type   | Required | Description                        |
| -------------- | ------ | -------- | ---------------------------------- |
| name           | string | Yes      | Display name of the vehicle        |
| spawnName      | string | Yes      | GTA V spawn name (model name)      |
| price          | number | Yes      | Vehicle price                      |
| stock          | number | Yes      | Available stock (0 = out of stock) |
| productionYear | number | No       | Production year for display        |
| maxSpeed       | number | No       | Maximum speed (km/h) for display   |
| speed          | number | No       | Speed rating (1-10)                |
| acceleration   | number | No       | Acceleration rating (1-10)         |
| handling       | number | No       | Handling rating (1-10)             |
| braking        | number | No       | Braking rating (1-10)              |

## Default Categories

The script includes translations for these category names:

| Category Name   | English         | Polish           |
| --------------- | --------------- | ---------------- |
| All             | All             | Wszystkie        |
| Compacts        | Compacts        | Kompakty         |
| Sedans          | Sedans          | Sedany           |
| SUVs            | SUVs            | SUVy             |
| Coupes          | Coupes          | Coupe            |
| Muscles         | Muscles         | Muscle           |
| Sports Classics | Sports Classics | Klasyki sportowe |
| Sports          | Sports          | Sportowe         |
| Super           | Super           | Super            |
| Motorcycles     | Motorcycles     | Motocykle        |
| Off-Road        | Off-Road        | Terenowe         |
| Vans            | Vans            | Vany             |
| Cycles          | Cycles          | Rowery           |
| Boats           | Boats           | Łodzie           |

## Example Full Vehicle Data

```json
{
    "categories": [
        {
            "name": "Compacts",
            "vehicles": [
                {
                    "name": "Blista",
                    "spawnName": "blista",
                    "price": 400,
                    "stock": 7,
                    "productionYear": 2014,
                    "maxSpeed": 165,
                    "speed": 5,
                    "acceleration": 6,
                    "handling": 7,
                    "braking": 6
                },
                {
                    "name": "Issi",
                    "spawnName": "issi2",
                    "price": 350,
                    "stock": 4,
                    "productionYear": 2016,
                    "maxSpeed": 155,
                    "speed": 5,
                    "acceleration": 6,
                    "handling": 8,
                    "braking": 6
                }
            ]
        },
        {
            "name": "Sports",
            "vehicles": [
                {
                    "name": "Elegy RH8",
                    "spawnName": "elegy2",
                    "price": 95000,
                    "stock": 2,
                    "productionYear": 2020,
                    "maxSpeed": 210,
                    "speed": 8,
                    "acceleration": 8,
                    "handling": 8,
                    "braking": 7
                }
            ]
        },
        {
            "name": "Super",
            "vehicles": [
                {
                    "name": "Adder",
                    "spawnName": "adder",
                    "price": 1000000,
                    "stock": 1,
                    "productionYear": 2021,
                    "maxSpeed": 250,
                    "speed": 10,
                    "acceleration": 9,
                    "handling": 7,
                    "braking": 8
                }
            ]
        }
    ]
}
```

## Adding New Vehicles

{% stepper %}
{% step %}

### Open dealer file

Open the dealer's JSON file in `data/dealers/`.
{% endstep %}

{% step %}

### Choose category

Find the appropriate category or create a new one.
{% endstep %}

{% step %}

### Add vehicle

Add a vehicle object with required fields (example below).
{% endstep %}

{% step %}

### Restart

Restart the resource.
{% endstep %}
{% endstepper %}

```json
{
    "name": "Your Vehicle Name",
    "spawnName": "vehicle_spawn_code",
    "price": 50000,
    "stock": 5,
    "productionYear": 2023,
    "maxSpeed": 200,
    "speed": 7,
    "acceleration": 7,
    "handling": 6,
    "braking": 6
}
```

## Stock System

The stock value determines if a vehicle is available for purchase:

| Stock Value | Status       | UI Display                 |
| ----------- | ------------ | -------------------------- |
| 0           | Out of Stock | Red badge, cannot purchase |
| 1+          | Available    | Green badge with count     |

Stock is currently display-only. To implement actual stock deduction on purchase, modify the server-side purchase handler.
