<?php

namespace App\Models;

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

/**
 * Idempotency breadcrumb: an external resource created during a run (wg peer,
 * pve token, vmid …). Persisted before the creating step advances.
 */
class RunResource extends Model
{
    public const UPDATED_AT = null;

    protected $fillable = ['run_id', 'host_id', 'kind', 'external_id'];

    public function run(): BelongsTo
    {
        return $this->belongsTo(ProvisioningRun::class, 'run_id');
    }

    public function host(): BelongsTo
    {
        return $this->belongsTo(Host::class, 'host_id');
    }
}
