<?php

namespace App\Models;

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

class ProjectSprint extends Model
{
    use HasFactory;

    protected $fillable = [
        'project_id',
        'sprint_id',
        'status',
    ];

    // Status constants for easy reference
    public const STATUS_PENDING = 'pending';
    public const STATUS_DONE = 'done';

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

    public function sprint()
    {
        return $this->belongsTo(Sprint::class);
    }

    /** Helpers */
    public function isPending(): bool
    {
        return $this->status === self::STATUS_PENDING;
    }

    public function isDone(): bool
    {
        return $this->status === self::STATUS_DONE;
    }
}
