<?php

namespace App\Models;

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

class GiveawayWinner extends Model
{
    use HasFactory;

    protected $fillable = [
        'giveaway_id',
        'user_id',
        'giveaway_entry_id',
        'prize_status',
        'admin_notes',
        'notified_at',
        'claimed_at',
    ];

    protected $casts = [
        'notified_at' => 'datetime',
        'claimed_at'  => 'datetime',
    ];

    // ---------- relationships ----------
    public function giveaway()
    {
        return $this->belongsTo(Giveaway::class);
    }

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

    public function entry()
    {
        return $this->belongsTo(GiveawayEntry::class, 'giveaway_entry_id');
    }
}
