<?php

declare(strict_types=1);

namespace App\Models;

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

/**
 * App\Models\ArtworkDownload
 *
 * @property-read Artwork $artwork
 * @property-read User|null $user
 */
class ArtworkDownload extends Model
{
	protected $table = 'artwork_downloads';

	public $timestamps = false;

	const CREATED_AT = 'created_at';
	const UPDATED_AT = null;

	protected $fillable = [
		'artwork_id',
		'user_id',
		'ip',
		'ip_address',
		'user_agent',
		'referer',
	];

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

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