<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LabReport extends Model
{
    protected $fillable = [
        'product_id', 'batch_number', 'test_date', 'lab_name',
        'test_type', 'purity_percentage', 'pdf_url', 'certificate_number', 'is_active',
    ];

    protected function casts(): array
    {
        return [
            'test_date' => 'date',
            'purity_percentage' => 'decimal:2',
            'is_active' => 'boolean',
        ];
    }

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