<?php

namespace Modules\ProductCompat\Entities;

use App\Product;
use Illuminate\Database\Eloquent\Model;

class PcCompatible extends Model
{
    protected $table = 'pc_compatibles';

    protected $fillable = [
        'business_id', 'product_id', 'compatible_product_id', 'relation_type',
        'source', 'confidence', 'needs_review', 'verified_at', 'verified_by',
    ];

    protected $casts = [
        'needs_review' => 'boolean',
        'verified_at'  => 'datetime',
    ];

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

    public function compatibleProduct()
    {
        return $this->belongsTo(Product::class, 'compatible_product_id');
    }
}
