<?php

namespace App\Models;

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

#[Fillable([
    'project_id',
    'position',
    'viewport_x',
    'viewport_y',
    'name',
    'layouts',
    'clip_overflow',
    'version',
])]
class Screen extends Model
{
    protected $touches = ['project'];

    protected function casts(): array
    {
        return [
            'layouts' => 'array',
            'position' => 'integer',
            'viewport_x' => 'integer',
            'viewport_y' => 'integer',
            'clip_overflow' => 'boolean',
            'version' => 'integer',
        ];
    }

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