<x-app-layout title="Calendar">
    <div class="mx-auto max-w-xl">
        <h1 class="text-xl font-semibold text-slate-900">Calendar integration</h1>
        <p class="mt-1 text-sm text-slate-600">Sync scheduled meetings to your calendar</p>

        <div class="mt-6 space-y-4">
            <div class="flex items-center justify-between rounded-2xl border border-slate-200 bg-white p-6">
                <div>
                    <h2 class="font-medium">Ladill Mail</h2>
                    <p class="text-sm text-slate-500">
                        @if ($mailConnected)
                            Connected — events sync to your mailbox calendar
                        @elseif (! $mailConfigured)
                            Not configured on this server
                        @else
                            Not connected
                        @endif
                    </p>
                </div>
                @if ($mailConfigured && ! $mailConnected)
                    <form method="POST" action="{{ route('meet.settings.calendar.mail') }}">
                        @csrf
                        <button type="submit" class="btn-primary">Connect</button>
                    </form>
                @endif
            </div>
            <div class="flex items-center justify-between rounded-2xl border border-slate-200 bg-white p-6">
                <div>
                    <h2 class="font-medium">Google Calendar</h2>
                    <p class="text-sm text-slate-500">{{ $googleConnected ? 'Connected' : 'Not connected' }}</p>
                </div>
                @if ($googleAuthUrl && ! $googleConnected)
                    <a href="{{ route('meet.settings.calendar.connect', 'google') }}" class="btn-primary">Connect</a>
                @endif
            </div>
            <div class="flex items-center justify-between rounded-2xl border border-slate-200 bg-white p-6">
                <div>
                    <h2 class="font-medium">Microsoft 365</h2>
                    <p class="text-sm text-slate-500">{{ $microsoftConnected ? 'Connected' : 'Not connected' }}</p>
                </div>
                @if ($microsoftAuthUrl && ! $microsoftConnected)
                    <a href="{{ route('meet.settings.calendar.connect', 'microsoft') }}" class="btn-primary">Connect</a>
                @endif
            </div>
            <p class="text-sm text-slate-500">Apple Calendar: use iCal download on each meeting detail page.</p>
        </div>
    </div>
</x-app-layout>
