<?php

namespace Modules\ProductCompat\Entities;

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

class PcProductStatus extends Model
{
    protected $table = 'pc_product_status';

    protected $fillable = [
        'business_id', 'product_id', 'checked_at', 'checked_by', 'custom_fields_cleared_at',
    ];

    protected $casts = [
        'checked_at'               => 'datetime',
        'custom_fields_cleared_at' => 'datetime',
    ];

    public function isChecked(): bool
    {
        return ! empty($this->checked_at);
    }

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