<?php

namespace App\Models;

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

class StickerMaster extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'item_id',
        'plant_id',
        'panel_box_code',
        'serial_number_motor',
        'serial_number_pump',
        'serial_number_pumpset',
        'pack_slip_motor',
        'pack_slip_pump',
        'pack_slip_pumpset',
        'name_plate_motor',
        'name_plate_pump',
        'name_plate_pumpset',
        'tube_sticker_motor',
        'tube_sticker_pump',
        'tube_sticker_pumpset',
        'warranty_card',
        'part_validation1',
        'part_validation2',
        'part_validation3',
        'part_validation4',
        'part_validation5',
        'laser_part_validation1',
        'laser_part_validation2',
        'load_rate',
        'bundle_quantity',
        'material_type',
        'created_at',
        'created_by',
        'updated_at',
        'updated_by',
    ];

    public function item()
    {
        return $this->belongsTo(Item::class, 'item_id', 'id');
        // return $this->belongsTo(Item::class);
    }

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

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

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