<?php

namespace App\Models;

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

class Episode extends Model
{
    use HasFactory;

    protected $fillable = [
        'series_id',
        'season_id',
        'episode_number',
        'title',
        'description',
        'thumbnail_image',
        'video_type',
        'youtube_url',
        'other_url',
        'video',
        'duration_seconds',
        'total_views',
        'is_premium',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'episode_number'   => 'integer',
            'duration_seconds' => 'integer',
            'total_views'      => 'integer',
            'is_premium'       => 'boolean',
            'status'           => 'integer',
        ];
    }

    public function series()
    {
        return $this->belongsTo(Series::class);
    }

    public function season()
    {
        return $this->belongsTo(Season::class);
    }
}
