<?php

namespace Modules\ProductCompat\Entities;

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

class PcDeviceCompat extends Model
{
    protected $table = 'pc_device_compat';

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

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

    public function deviceModel()
    {
        return $this->belongsTo(PcDeviceModel::class, 'device_model_id');
    }

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