<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Vehicles extends Model
{
    protected $table = 'vehicles';

    protected $fillable = [
    'year',
    'make',
    'model',
    'type',
    'doNotJudge',
    'owner'
    ];

    protected function casts(): array
    {
        return [
            'owner' => 'integer',
            'created_at' => 'datetime',
            'updated_at' => 'datetime',
        ];
    }

    public function vehicleType()
    {
        return $this->belongsTo(CarShowCategory::class, 'type', 'id');
    }

    public function vehicleOwner()
    {
        return $this->belongsTo(Bidders::class, 'owner', 'bidder_assigned_number');
    }

    public function vehicleScores()
    {
        return $this->hasMany(VehicleScores::class, 'vehicle');
    }

    public function CarShowWinner()
    {
        return $this->belongsTo(CarShowWinner::class, 'vehicle');
    }
}
