<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Input extends Model
{
    use HasFactory;
    
    protected $fillable = [
        'code',
        'codigo',
        'codigo_interno',
        'id_unit',
        'id_category',
        'id_supplier',
        'igv',
        'igv_porcentaje',
        'stock',
        'name',
    ];

    public function category()
    {
        return $this->belongsTo(Category::class, 'id_category');
    }
    public function unit()
    {
        return $this->belongsTo(Unit::class, 'id_unit');
    }
    public function supplier()
    {
        return $this->belongsTo(Supplier::class, 'id_supplier');
    }
    public function depositInputs()
    {
        return $this->hasMany(DepositInput::class, 'id_input');
    }
    public function costInputs()
    {
        return $this->hasMany(CostInput::class, 'id_input');
    }
}
