<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * App\Models\ArtworkStats
 *
 * @property-read Artwork $artwork
 */
class ArtworkStats extends Model
{
	protected $table = 'artwork_stats';

	protected $primaryKey = 'artwork_id';

	public $incrementing = false;

	public $timestamps = false;

	protected $fillable = [
		'artwork_id',
		'views',
		'downloads',
		'favorites',
		'rating_avg',
		'rating_count',
		// V2 ranking columns
		'comments_count',
		'shares_count',
		'ranking_score',
		'engagement_velocity',
		'shares_24h',
		'comments_24h',
		'favourites_24h',
		// Rising / Heat columns
		'heat_score',
		'heat_score_updated_at',
		'views_1h',
		'favourites_1h',
		'comments_1h',
		'shares_1h',
		'downloads_1h',
	];

	public function artwork(): BelongsTo
	{
		return $this->belongsTo(Artwork::class, 'artwork_id');
	}
}
