<?php

declare(strict_types=1);

namespace App\Models;

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

class GroupProjectMember extends Model
{
    use HasFactory;

    protected $fillable = [
        'group_project_id',
        'user_id',
        'role_label',
        'is_lead',
    ];

    protected $casts = [
        'is_lead' => 'boolean',
    ];

    public function project(): BelongsTo
    {
        return $this->belongsTo(GroupProject::class, 'group_project_id');
    }

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