<?php

namespace App\Models;

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

class SopStep extends Model
{
    protected $table = 'sop_steps';

    protected $fillable = [
        'sop_phase_id',
        'num',
        'icon',
        'sublabel',
        'name',
        'desc',
        'note',
        'tip',
        'tags',
        'sources',
        'kpis',
        'templates',
        'checklist',
        'sort_order',
    ];

    protected function casts(): array
    {
        return [
            'tags' => 'array',
            'sources' => 'array',
            'kpis' => 'array',
            'templates' => 'array',
            'checklist' => 'array',
        ];
    }

    public function phase(): BelongsTo
    {
        return $this->belongsTo(SopPhase::class, 'sop_phase_id');
    }
}
