<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ContestWinner extends Model
{
    protected $table = 'contest_winners';

    protected $fillable = [
        'user_id',
        'contest_id',
        'contest_participant_id',
        'prize_name',
        'prize_amount',
        'rank',
    ];

    protected $casts = [
        'prize_amount' => 'decimal:2',
        'rank' => 'integer',
    ];

    public function contestParticipant()
    {
        return $this->belongsTo(ContestParticipant::class, 'contest_participant_id');
    }

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

    public function contest()
    {
        return $this->belongsTo(Contest::class);
    }
}
