<?php

namespace App\Models;

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

class GamePlatform extends Model
{
    protected $fillable = [
        'game_id',
        'name',
        'slug',
        'sort_order',
    ];

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

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

    public function playerGamePlatforms(): HasMany
    {
        return $this->hasMany(PlayerGamePlatform::class);
    }

    public function primaryPlatformProfiles(): HasMany
    {
        return $this->hasMany(PlayerGameProfile::class, 'primary_platform_id');
    }
}
