<?php

namespace App\Models;

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

class Plant extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'code',
        'company_id',
        'name',
        'address',
        'warehouse_number',
    ];

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

    public function blocks(): HasMany
    {
        return $this->hasMany(Block::class, 'plant_id', 'id');
    }

    public function lines(): HasMany
    {
        return $this->hasMany(Line::class, 'plant_id', 'id');
    }

    public function getLineNames()
    {
        return $this->hasMany(Line::class, 'plant_id', 'id');
    }

    public function items(): HasMany
    {
        return $this->hasMany(Item::class, 'plant_id', 'id');
    }

    public function stickersMasters(): HasMany
    {
        return $this->hasMany(StickerMaster::class, 'plant_id', 'id');
    }

    public function locators(): HasMany
    {
        return $this->hasMany(Locator::class, 'plant_id', 'id');
    }

    public function weightValidations(): HasMany
    {
        return $this->hasMany(WeightValidation::class, 'plant_id', 'id');
    }

    public function invoiceValidations()
    {
        return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
    }

    public function stockDataMasters()
    {
        return $this->hasMany(StockDataMaster::class, 'plant_id', 'id');
    }

    public function qualityValidations()
    {
        return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
    }

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

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

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

    public function pumpTestingEntries()
    {
        return $this->hasMany(PumpTestingEntry::class, 'plant_id', 'id');
    }

    public function pumpTestingResults()
    {
        return $this->hasMany(PumpTestingResult::class, 'plant_id', 'id');
    }

    public function guardNames()
    {
        return $this->hasMany(GuardName::class, 'plant_id', 'id');
    }

    public function checkPointNames()
    {
        return $this->hasMany(CheckPointName::class, 'plant_id', 'id');
    }

    public function checkPointTimes()
    {
        return $this->hasMany(CheckPointTime::class, 'plant_id', 'id');
    }

    public function guardPatrolEntries()
    {
        return $this->hasMany(GuardPatrolEntry::class, 'plant_id', 'id');
    }

    public function workGroupMasters()
    {
        return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id');
    }

    public function machines()
    {
        return $this->hasMany(Machine::class, 'plant_id', 'id');
    }

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

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

    public function productionOrder()
    {
        return $this->hasMany(ProductionOrder::class, 'plant_id', 'id');
    }

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

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

    public function equipmentMasters()
    {
        return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
    }

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

    // public function ModelMasters()
    // {
    //     return $this->hasMany(ModelMaster::class, 'plant_id', 'id');
    // }

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

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

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

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

    public function users()
    {
        return $this->hasMany(User::class, 'plant_id', 'id');
    }

    public function vehicleEntries()
    {
        return $this->hasMany(VehicleEntry::class, 'plant_id', 'id');
    }

    public function leakTestReadings()
    {
        return $this->hasMany(LeakTestReading::class, 'plant_id', 'id');
    }

    public function beforeTestReadings()
    {
        return $this->hasMany(BeforeTestReading::class, 'plant_id', 'id');
    }

    public function asrsItemValidations()
    {
        return $this->hasMany(AsrsItemValidation::class, 'plant_id', 'id');
    }

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

    public function characteristicApproverMaster()
    {
        return $this->hasMany(CharacteristicApproverMaster::class, 'plant_id', 'id');
    }

    public function panelBoxValidations()
    {
        return $this->hasMany(PanelBoxValidation::class, 'plant_id', 'id');
    }
}
