<?php

namespace App\Models;

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

class Item extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'plant_id',
        'line_id',
        'category',
        'code',
        'description',
        'hourly_quantity',
        'uom',
    ];

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

    public function line()
    {
        return $this->belongsTo(Line::class, 'line_id', 'id');
    }

    public function stickerMasters()
    {
        return $this->hasMany(StickerMaster::class, 'item_id', 'id');
    }

    public function productionQuantities()
    {
        return $this->hasMany(ProductionQuantity::class);
    }

    public function motorTestingMasters()
    {
        return $this->hasMany(MotorTestingMaster::class, 'item_id', 'id');
    }

    public function testingPanelReadings()
    {
        return $this->hasMany(TestingPanelReading::class);
    }

    public function pumpTestingMasters()
    {
        return $this->hasMany(PumpTestingMaster::class, 'item_id', 'id');
    }

    public function processOrders()
    {
        return $this->hasMany(ProcessOrder::class);
    }

    public function productionOrders()
    {
        return $this->hasMany(ProductionOrder::class);
    }

    public function productCharacteristicsMasters()
    {
        return $this->hasMany(ProductCharacteristicsMaster::class);
    }

    public function characteristicValues()
    {
        return $this->hasMany(CharacteristicValue::class);
    }

    public function ClassCharacteristics()
    {
        return $this->hasMany(ClassCharacteristic::class, 'item_id', 'id');
    }

    public function windedSerialValidationErrors()
    {
        return $this->hasMany(WindedSerialValidationError::class, 'item_id', 'id');
    }

    public function requestCharacteristics()
    {
        return $this->hasMany(RequestCharacteristic::class, 'item_id', 'id');
    }

    public function wireMasterPacking()
    {
        return $this->hasMany(WireMasterPacking::class, 'item_id', 'id');
    }

    public function productionCharacteristics()
    {
        return $this->hasMany(ProductionCharacteristic::class, 'item_id', 'id');
    }

    public function tempClassCharacteristics()
    {
        return $this->hasMany(TempClassCharacteristic::class, 'item_id', 'id');
    }

    public function weightValidations()
    {
        return $this->hasMany(WeightValidation::class);
    }

    public function locatorValidations()
    {
        return $this->hasMany(LocatorValidation::class, 'item_id', 'id');
    }

    public function panelGrMasters()
    {
        return $this->hasMany(PanelGrMaster::class, 'item_id', 'id');
    }
}
