<?php

namespace App\Models;

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

class ProductCharacteristicsMaster extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'plant_id',
        'item_id',
        'line_id',
        'work_group_master_id',
        'machine_id',
        'characteristics_type',
        'name',
        'category',
        'inspection_type',
        'lower',
        'upper',
        'middle',
        'created_at',
        'updated_at',
        'created_by',
        'updated_by',
    ];

    public function plant(): BelongsTo
    {
        return $this->belongsTo(Plant::class);
    }

    public function line(): BelongsTo
    {
        return $this->belongsTo(Line::class);
    }

    public function workGroupMaster(): BelongsTo
    {
        return $this->belongsTo(WorkGroupMaster::class);
    }

    public function machine(): BelongsTo
    {
        return $this->belongsTo(Machine::class);
    }
    // public function machine()
    // {
    //     return $this->belongsTo(\App\Models\Machine::class, 'machine_id');
    // }

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