package com.manalejandro.odb2bluetooth.data.database.entities

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey

/**
 * Entity representing a vehicle model in the database
 */
@Entity(
    tableName = "models",
    foreignKeys = [
        ForeignKey(
            entity = Brand::class,
            parentColumns = ["id"],
            childColumns = ["brand_id"],
            onDelete = ForeignKey.CASCADE
        )
    ],
    indices = [Index("brand_id")]
)
data class Model(
    @PrimaryKey(autoGenerate = true)
    val id: Int = 0,
    @ColumnInfo(name = "brand_id")
    val brandId: Int,
    val name: String,
    @ColumnInfo(name = "full_name")
    val fullName: String
)

