<?php

namespace Modules\SystemCore\App\Models;

use App\Traits\UserActionsTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class CorePurchaseOrderAttachment extends Model
{
    use SoftDeletes, UserActionsTrait;

    protected $table = 'core_purchase_order_attachments';

    protected $fillable = [
        'purchase_order_id',
        'file_path',
        'file_name',
        'file_type',
        'created_by_id',
        'updated_by_id',
    ];

    /**
     * Get the purchase order that owns the attachment
     */
    public function purchaseOrder(): BelongsTo
    {
        return $this->belongsTo(CorePurchaseOrder::class, 'purchase_order_id');
    }
}
