# Vehicles

Aggregates key vehicle data including identifiers, technical specifications,  and ownership details filtered to specific partner teams and users.

**SQL:** `vehicles`

## Schema

| Column Name                    | Data Type     | Description                                                              |
|:-------------------------------|:--------------|:-------------------------------------------------------------------------|
| **Primary ID**                 |               |                                                                          |
| id                             | INTEGER       | Primary key                                                              |
| **Other IDs**                  |               |                                                                          |
| country_id                     | INTEGER       | References the country where the vehicle is registered                   |
| integration_id                 | INTEGER       | Identifier linking the vehicle to its integration                        |
| model_id                       | INTEGER       | References the specific vehicle model type                               |
| brand_id                       | INTEGER       | References the vehicle manufacturer/brand                                |
| team_id                        | INTEGER       | References the team that manages or owns the vehicle                     |
| user_id                        | INTEGER       | References the primary user assigned to the vehicle                      |
| owner_id                       | INTEGER       | team_id or user_id based on owner_type                                   |
| **Timestamps**                 |               |                                                                          |
| created_at                     | TIMESTAMP_NTZ | Timestamp when the vehicle record was first created                      |
| integration_created_at         | TIMESTAMP_NTZ | Timestamp when the vehicle was first integrated                          |
| updated_at                     | TIMESTAMP_NTZ | Timestamp when the vehicle record was last modified                      |
| integration_updated_at         | TIMESTAMP_NTZ | Timestamp when the vehicle integration was last modified                 |
| **Attributes**                 |               |                                                                          |
| identifier                     | VARCHAR       | External identifier or reference code for the vehicle                    |
| name                           | VARCHAR       | Display name or label for the vehicle                                    |
| model_name                     | VARCHAR       | Name of the vehicle model                                                |
| brand_name                     | VARCHAR       | Name of the vehicle manufacturer/brand                                   |
| model_variant                  | VARCHAR       | Specific variant or trim level of the vehicle model                      |
| license_plate                  | VARCHAR       | Vehicle registration plate number                                        |
| capacity_kwh                   | NUMBER        | Battery capacity in kilowatt-hours                                       |
| default_max_battery_percentage | NUMBER        | Default maximum charging limit as a percentage of total battery capacity |
| integration_status             | VARCHAR       | Current status of the vehicle in the integration system                  |
| max_kw_ac                      | NUMBER        | Maximum AC charging power in kilowatts                                   |
| max_kw_dc                      | NUMBER        | Maximum DC charging power in kilowatts                                   |
| owner_type                     | VARCHAR       | Classification of the vehicle owner in the system (owner or team)        |
| **Filters**                    |               |                                                                          |
| is_deleted_pii                 | BOOLEAN       | Indicates if a row has PII that have been nullified                      |

## Data Inclusion Criteria
- is not deleted
- if owned by a team, the team is among partner's teams
- if owned by a user, the user is among partner's users

## Data Flow
| Upstream tables | Upstream tables |
|:----------------|:----------------|
| `users`         | none            |
| `teams`         |                 |
