<?php

declare(strict_types=1);

namespace ImovelZapAi\Conversations\Application\Actions;

use ImovelZapAi\Conversations\Infrastructure\Persistence\Eloquent\BrokerNoteModel;
use ImovelZapAi\Tenancy\Support\TenantContext;
use InvalidArgumentException;

final class DeleteBrokerNoteAction
{
    public function execute(string $tenantId, BrokerNoteModel $note): void
    {
        TenantContext::set($tenantId);

        if ((string) $note->tenant_id !== $tenantId) {
            throw new InvalidArgumentException('Nota não encontrada.');
        }

        $note->delete();
    }
}
