<?php

namespace App\Models;

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

class Video extends Model
{
    use HasFactory;

    protected $fillable = [
        'title',
        'category_id',
        'thumbnail_image',
        'video_type',
        'youtube_url',
        'other_url',
        'video',
        'description',
        'status',
        'total_views',
        'is_premium',
    ];

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

    public function category()
    {
        return $this->belongsTo(Category::class);
    }
}
