<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class RideRecommendation extends Model
{
    use HasFactory;

    protected $fillable = [
        'ride_id',
        'offer_id',
        'position',
        'score',
        'reason',
        'was_viewed',
        'was_clicked',
        'clicked_at',
    ];

    protected $casts = [
        'score' => 'decimal:2',
        'was_viewed' => 'boolean',
        'was_clicked' => 'boolean',
        'clicked_at' => 'datetime',
    ];

    public function ride(): BelongsTo
    {
        return $this->belongsTo(Ride::class);
    }

    public function offer(): BelongsTo
    {
        return $this->belongsTo(Offer::class);
    }
}
