<?php

namespace App\Livewire\Admin;

use LivewireUI\Modal\ModalComponent;

/**
 * Confirmation before the catalogue is actually pushed into Stripe (R23).
 *
 * Only the live run asks. The dry run changes nothing — it counts what is
 * missing and prints it — which is exactly why it is the first button and this
 * one is the second: an operator sees what would happen before anything does.
 *
 * Mutates nothing itself; confirming dispatches back to Admin\Integrations,
 * whose syncCatalogue() keeps its own capability check.
 */
class ConfirmSyncCatalogue extends ModalComponent
{
    public function mount(): void
    {
        $this->authorize('plans.manage');
    }

    public function confirm(): void
    {
        $this->authorize('plans.manage');
        $this->dispatch('catalogue-sync-confirmed');
        $this->closeModal();
    }

    public function render()
    {
        return view('livewire.admin.confirm-sync-catalogue');
    }
}
