<?php

namespace App\Models;

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

class ProjectTicket extends Model
{
    protected $fillable = [
        'project_id',
        'created_by',
        'name',
        'description',
        'priority',
        'status',
        'is_deleted',
        'created_at',
        'updated_at',
        'deleted_at',
    ];

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

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

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