<?php

namespace App\Services\SlugScoped;

use Illuminate\Database\Eloquent\Model;

class SlugPersistResult
{
    public function __construct(
        public readonly Model $model,
        public readonly bool $wasRestored = false,
        public readonly bool $wasReplaced = false,
    ) {
    }

    public function meta(): array
    {
        return [
            'was_restored' => $this->wasRestored,
            'was_replaced' => $this->wasReplaced,
            'surviving_id' => $this->model->getKey(),
        ];
    }
}
