<?php

namespace App\Models;

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

class ProjectRevision extends Model
{
    use HasFactory;

    protected $fillable = [
        'project_id',
        'user_id',
        'commit_message',
        'code',
        'settings',
    ];

    protected $casts = [
        'code' => 'array',
        'settings' => 'array',
    ];

    protected $hidden = [
        'code',
    ];

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

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