<?php

declare(strict_types=1);

namespace App\Models;

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

class CollectionQualitySnapshot extends Model
{
    use HasFactory;

    protected $fillable = [
        'collection_id',
        'snapshot_date',
        'quality_score',
        'health_score',
        'metadata_completeness_score',
        'freshness_score',
        'engagement_score',
        'readiness_score',
        'flags_json',
    ];

    protected $casts = [
        'snapshot_date' => 'date',
        'flags_json' => 'array',
    ];

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