<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ActionTicket extends Model
{
    protected $fillable = [
        'user_id',
        'raffle_id',
        'ticket_number',
        'chest_prize_id',
        'rarity',
        'transaction_id',
        'keys_granted',
        'revealed_at',
    ];

    protected $casts = [
        'keys_granted' => 'integer',
        'revealed_at' => 'datetime',
    ];

    public function transaction()
    {
        return $this->belongsTo(Transaction::class);
    }

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

    public function raffle()
    {
        return $this->belongsTo(Raffle::class);
    }

    public function chestPrize()
    {
        return $this->belongsTo(ChestPrize::class, 'chest_prize_id');
    }
}
