<?php

namespace App\Models;

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

class MetroLine extends Model
{
    use HasFactory;

    protected $table = 'metro_lines';

    protected $fillable = [
        'project_id',
        'naam',
        'color',
        'type',
        'order',
    ];

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

    public function metroNodes(): HasMany
    {
        return $this->hasMany(MetroNode::class);
    }

    public function isBuiltIn(): bool
    {
        return in_array($this->type, ['lifecycle', 'commitments', 'documents']);
    }
}
