{{if .NotConfigured}}
<p><strong>Setup Telegram Bot:</strong></p>
<ol class="link-instructions">
	<li>Message <a href="https://t.me/BotFather" target="_blank" rel="noopener noreferrer">@BotFather</a> on Telegram</li>
	<li>Send <code>/newbot</code> and follow the prompts</li>
	<li>Copy the bot token from BotFather</li>
	<li>Message <a href="https://t.me/userinfobot" target="_blank" rel="noopener noreferrer">@userinfobot</a> to get your Chat ID</li>
	<li>Enter both below:</li>
</ol>
<form class="auth-form" data-handler="telegram">
	<div class="form-group">
		<label for="telegram-bot-token">Bot Token:</label>
		<input type="text" id="telegram-bot-token" name="bot_token" placeholder="123456789:ABCdefGHIjklMNOpqrsTUVwxyz" required>
	</div>
	<div class="form-group">
		<label for="telegram-chat-id">Chat ID:</label>
		<input type="text" id="telegram-chat-id" name="chat_id" placeholder="123456789" required>
	</div>
	<button type="submit" class="btn-primary">Link</button>
	<div id="telegram-auth-status" class="auth-status"></div>
</form>
{{else if .Error}}
<p>Error: {{.Error}}</p>
<button class="btn-secondary" data-action="reload">Retry</button>
{{else if .NeedsChatID}}
<p><strong>Complete Setup:</strong></p>
<p>Bot is configured, but Chat ID is missing.</p>
<form class="auth-form" data-handler="telegram-chatid" data-bot-token="{{.BotToken}}">
	<div class="form-group">
		<label for="telegram-chat-id-only">Chat ID:</label>
		<input type="text" id="telegram-chat-id-only" name="chat_id" placeholder="Get from @userinfobot" required>
	</div>
	<button type="submit" class="btn-primary">Save Chat ID</button>
	<div id="telegram-chatid-status" class="auth-status"></div>
</form>
{{else}}
<button class="btn-danger" data-action="delete-telegram">Unlink</button>
{{end}}

