<?php

declare(strict_types=1);

namespace Kylin\Manufacturing\Models;

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

/**
 * 生产线
 */
class ProductionLine extends Model
{
    protected $table = 'kylin_mfg_production_lines';

    protected $fillable = [
        'name',
        'code',
        'workshop',
        'description',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'status' => 'string',
        ];
    }

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

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