<?php

declare(strict_types=1);

namespace App\Models\Ecommerce\Product\Inventory;

use App\Models\Ecommerce\Product\Product\Product;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class InventoryHistoryItem extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'inventory_history_id',
        'product_id',
        'quantity',
        'total',
        'cost_amount',
    ];

    /**
     * Inventory history
     */
    public function inventoryHistory(): BelongsTo
    {
        return $this->belongsTo(InventoryHistory::class, 'inventory_history_id');
    }

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