<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class WorkflowStep extends Model
{
    protected $fillable = ['workflow_id', 'created_by', 'name', 'order', 'is_end'];

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

    public function workflow()
    {
        return $this->belongsTo(Workflow::class);
    }

    public function transitionsFrom()
    {
        return $this->hasMany(WorkflowTransition::class, 'from_step_id');
    }

    public function transitionsTo()
    {
        return $this->hasMany(WorkflowTransition::class, 'to_step_id');
    }
}
