<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>FediBooks</title>
	{% include 'imports.html' %}
</head>

<body>
	<div class="container">
		<h1 class="thin centred">Create bot</h1>
		<p class="large thin centred">Step {{ session['step'] }}</p>
	</div>
	
	<div class="container centred">
		<form action="/bot/create" method="POST">
			{% if session['step'] == 1 %}
			<label for="instance" class="important">What instance will your bot's account be on?</label>
			<input type="text" name="instance" class="full-width" placeholder="botsin.space">
			<br>

			{% elif session['step'] == 2 %}
			<h2 class="thin centred">Detected instance type: {{ session['instance_type'] }}</h2>
			<p>{{ session['instance'] }} is a {{ session['instance_type'] }} instance. {% if session['instance_type'] == Pleroma %}Unfortunately, bots on Pleroma instances cannot listen for replies yet. This means that your bot will have its reply functionality disabled.{% else %}{{ session['instance_type'] }} instances are fully supported, and your bot will have all functionality available.{% endif %}</p>

			{% elif session['step'] == 3 %}
			<p>You now need to give your bot access to the {{ session['instance'] }} account you have created for it. If you have not yet created an account on {{ session['instance'] }} for your bot to use, please do so now.</p>
			<p>Sign in to the {{ session['instance'] }} account you want your bot to use, then click next to begin the authorisation process.</p>

			{% elif session['step'] == 4 %}
			<h2 class="thin centred">Congratulations!</h2>
			<p>FediBooks has successfully authenticated with {{ session['instance'] }}, and your bot is ready to be configured. Click finish to return to the bot management screen.</p>
			<p>To get your bot working, you need to add at least one account for it to learn from. You can do so by clicking the <i class="fas fa-users"></i> button. To configure settings such as posting frequency and content warnings, click the <i class="fas fa-cog"></i> button.</p>

			{% else %}
			<h2 class="thin centred">Error</h2>
			<p>An unknown error has occurred.</p>

			{% endif %}

			<div class="container centred">
				<a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a>
				{% if session['step'] != 1 %}
					<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button>
				{% endif %}
					<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>
				</div>
		</form>
	</div>

	{% include 'footer.html' %}
</body>
</html>