<?php

namespace App\Models;

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

class PriceHistory extends Model
{
    protected $fillable = [
        'product_id',
        'user_id',
        'old_purchase_price',
        'new_purchase_price',
        'old_sale_price',
        'new_sale_price',
    ];

    /**
     * Get the product associated with this price history entry.
     */
    public function product(): BelongsTo
    {
        return $this->belongsTo(Product::class);
    }

    /**
     * Get the user who made the price change.
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}
