<?php

namespace App\Models\Analytics;

use Illuminate\Database\Eloquent\Model;
use App\Models\User;
use App\Models\Anime;
use App\Models\Episode;

class WatchEvent extends Model
{
    public $timestamps = false;

    protected $table = 'analytics_watch_events';

    protected $fillable = [
        'user_id', 'session_id', 'anime_id', 'episode_id',
        'season_number', 'episode_number',
        'seconds_watched', 'total_seconds', 'percent_complete',
        'created_at',
    ];

    protected $casts = [
        'created_at' => 'datetime',
    ];

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