<!--
  Familiar - Self-hosted AI Agent
  Copyright (c) 2026 George Scott Foley
  
  Licensed under the MIT License
  For commercial licensing, contact: licensing@familiar.ai
-->
{% extends "base.html" %}

{% block title %}Invite User - Familiar Admin{% endblock %}

{% block content %}
<div class="max-w-lg mx-auto">
    <div class="mb-6">
        <a href="{{ url_for('admin.users') }}" class="text-purple-600 hover:text-purple-800">
            ← Back to Users
        </a>
    </div>
    
    <div class="bg-white rounded-lg shadow p-6">
        <h1 class="text-2xl font-bold text-gray-800 mb-6">Invite New User</h1>
        
        <form method="POST" class="space-y-6">
            <div>
                <label for="email" class="block text-sm font-medium text-gray-700 mb-1">
                    Email Address *
                </label>
                <input type="email" 
                       id="email" 
                       name="email" 
                       required
                       class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent"
                       placeholder="newuser@organization.org">
            </div>
            
            <div>
                <label for="role" class="block text-sm font-medium text-gray-700 mb-1">
                    Role
                </label>
                <select id="role" 
                        name="role" 
                        class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent">
                    <option value="staff">Staff - Normal access, own data</option>
                    <option value="readonly">Read Only - View only, no actions</option>
                    <option value="admin">Admin - Full access, manage users</option>
                </select>
            </div>
            
            <div class="bg-gray-50 rounded-lg p-4">
                <h4 class="font-medium text-gray-700 mb-2">Role Permissions</h4>
                <ul class="text-sm text-gray-600 space-y-1">
                    <li><strong>Staff:</strong> Chat with Familiar, manage own tasks/calendar, view shared data</li>
                    <li><strong>Read Only:</strong> View data only, cannot send messages or make changes</li>
                    <li><strong>Admin:</strong> Everything, plus manage users and system settings</li>
                </ul>
            </div>
            
            <button type="submit" 
                    class="w-full py-3 bg-purple-600 text-white rounded-lg font-semibold hover:bg-purple-700 transition">
                Send Invitation
            </button>
        </form>
        
        <p class="text-center text-sm text-gray-500 mt-6">
            The user will receive an email with a link to complete their registration.
        </p>
    </div>
</div>
{% endblock %}
