<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Story extends Model
{
    protected $fillable = [
        'title',
        'media_path',
        'media_type',
        'button_text',
        'action_type',
        'action_value',
        'is_active',
        'sort_order',
        'expires_at',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'sort_order' => 'integer',
        'expires_at' => 'datetime',
    ];

    /**
     * Relación opcional con el Sorteo si action_type es 'raffle'
     */
    public function raffle()
    {
        return $this->belongsTo(Raffle::class, 'action_value');
    }
}
