<?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 GroupDiscoveryMetric extends Model
{
    use HasFactory;

    protected $fillable = [
        'group_id',
        'freshness_score',
        'activity_score',
        'release_score',
        'trust_score',
        'collaboration_score',
        'last_calculated_at',
    ];

    protected $casts = [
        'freshness_score' => 'float',
        'activity_score' => 'float',
        'release_score' => 'float',
        'trust_score' => 'float',
        'collaboration_score' => 'float',
        'last_calculated_at' => 'datetime',
    ];

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