<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class OpnameItem extends Model
{
    protected $fillable = [
        'stock_opname_id', 'product_id', 'sku', 'product_name',
        'system_stock', 'physical_count', 'difference', 'notes',
    ];

    protected function casts(): array
    {
        return [
            'system_stock'   => 'integer',
            'physical_count' => 'integer',
            'difference'     => 'integer',
        ];
    }

    public function stockOpname()
    {
        return $this->belongsTo(StockOpname::class);
    }

    public function product()
    {
        return $this->belongsTo(Product::class);
    }
}
