<?php

namespace App\Models;

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

class ResearcherTeam extends Model
{
    use HasFactory;

    protected $fillable = [
        'researcher_id',
        'user_id',
        'role',
        'added_at',
    ];

    protected $casts = [
        'added_at' => 'datetime',
    ];

    /**
     * Get the researcher profile this team belongs to
     */
    public function researcher(): BelongsTo
    {
        return $this->belongsTo(ResearcherProfile::class, 'researcher_id');
    }

    /**
     * Get the user who is a team member
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}
