<?php

namespace App\Models;

use App\Models\Items\Item;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * 공정-품목 연결 모델 (개별 품목 지정용)
 */
class ProcessItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'process_id',
        'item_id',
        'priority',
        'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'priority' => 'integer',
    ];

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

    /**
     * 품목
     */
    public function item(): BelongsTo
    {
        return $this->belongsTo(Item::class);
    }
}
