<?php

namespace App\Models;

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

class DriverReferral extends Model
{
    protected $fillable = [
        'referrer_driver_id',
        'referred_driver_id',
        'referral_code',
        'referred_at',
        'bonus_months_remaining',
    ];

    protected $casts = [
        'referred_at' => 'date',
    ];

    public function referrer(): BelongsTo
    {
        return $this->belongsTo(User::class, 'referrer_driver_id');
    }

    public function referred(): BelongsTo
    {
        return $this->belongsTo(User::class, 'referred_driver_id');
    }

}
