<?php

namespace App\Models;

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

class WeeklyTraderRanking extends Model
{
    protected $fillable = [
        'user_id',
        'week_start',
        'week_end',
        'rank',
        'score',
        'discipline_score',
        'trades_count',
        'challenge_progress',
        'badges_count',
        'consistency_score',
        'low_risk_score',
        'badges',
    ];

    protected function casts(): array
    {
        return [
            'week_start' => 'date',
            'week_end' => 'date',
            'badges' => 'array',
        ];
    }

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