<?php

namespace App\Models\Analytics;

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

class PageView extends Model
{
    public $timestamps = false;

    protected $table = 'analytics_pageviews';

    protected $fillable = [
        'user_id', 'session_id', 'url', 'page_type',
        'anime_id', 'episode_id', 'ip', 'country', 'city',
        'device', 'browser', 'referrer', 'is_bot', 'user_agent',
        'time_on_page', 'created_at',
    ];

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

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