<?php

declare(strict_types=1);

namespace App\Models;

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

class Leaderboard extends Model
{
    use HasFactory;

    public const TYPE_CREATOR = 'creator';
    public const TYPE_ARTWORK = 'artwork';
    public const TYPE_GROUP = 'group';
    public const TYPE_STORY = 'story';
    public const TYPE_WORLD = 'world';

    public const PERIOD_DAILY = 'daily';
    public const PERIOD_WEEKLY = 'weekly';
    public const PERIOD_MONTHLY = 'monthly';
    public const PERIOD_ALL_TIME = 'all_time';

    protected $fillable = [
        'type',
        'entity_id',
        'score',
        'period',
    ];

    protected function casts(): array
    {
        return [
            'entity_id' => 'integer',
            'score' => 'float',
        ];
    }
}
