<?php

namespace App\Models;

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

class UserPoint extends Model
{
    protected $fillable = [
        'user_id',
        'points',
        'reason',
        'pointable_type',
        'pointable_id',
    ];

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

    // Polymorphic: can link to a Prediction, PollVote, etc.
    public function pointable(): MorphTo
    {
        return $this->morphTo();
    }
}
