<?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 CoreSalesOrderAttachment extends Model
{
    use SoftDeletes, UserActionsTrait;

    protected $table = 'core_sales_order_attachments';

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

    /**
     * Get the sales order that owns the attachment
     */
    public function salesOrder(): BelongsTo
    {
        return $this->belongsTo(CoreSalesOrder::class, 'sales_order_id');
    }
}
