<?php

namespace App\Models;

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

class BaselineSnapshot extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'summary_jsonb' => 'array',
        'captured_at' => 'datetime',
    ];

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

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

    public function items(): HasMany
    {
        return $this->hasMany(BaselineSnapshotItem::class);
    }
}
