<?php

namespace App\Models;

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

class ProcessStep extends Model
{
    use HasFactory;

    protected $fillable = [
        'process_id',
        'step_code',
        'step_name',
        'is_required',
        'needs_approval',
        'needs_inspection',
        'is_active',
        'sort_order',
        'connection_type',
        'connection_target',
        'completion_type',
        'options',
    ];

    protected $casts = [
        'is_required' => 'boolean',
        'needs_approval' => 'boolean',
        'needs_inspection' => 'boolean',
        'is_active' => 'boolean',
        'sort_order' => 'integer',
        'options' => 'array',
    ];

    /**
     * 공정
     */
    public function process(): BelongsTo
    {
        return $this->belongsTo(Process::class);
    }
}
