{# Legacy config form — single-bot schema #}
{% from "_macros.html" import select_options %}

<form method="post" action="/config">
<input type="hidden" name="_schema" value="legacy">

<div class="config-card">
  <h3 class="config-section-label small-caps">General</h3>

  <div class="form-group">
    <label class="form-label small-caps" for="log_level">Log level</label>
    <select id="log_level" name="log_level" class="form-input">
      {{ select_options(log_level_options, config.log_level) }}
    </select>
  </div>

  <div class="form-group">
    <label class="form-label small-caps" for="workdir">Working directory</label>
    <input id="workdir" name="workdir" type="text" class="form-input"
           value="{{ workdir }}" required>
  </div>
</div>

<div class="config-card">
  <h3 class="config-section-label small-caps">Telegram</h3>

  <div class="form-group">
    <label class="form-label small-caps" for="telegram_token">Token</label>
    <input id="telegram_token" name="telegram_token" type="password" class="form-input"
           value="{{ masked_token if tg_token else '' }}">
    <label class="inline-label">
      <input type="checkbox" onclick="toggleToken()"> Reveal token
    </label>
  </div>

  <div class="form-group">
    <label class="form-label small-caps" for="owner_id">Owner ID</label>
    <input id="owner_id" name="owner_id" type="text" class="form-input"
           value="{{ owner_id }}">
  </div>

  <div class="form-group">
    <label class="form-label small-caps" for="allowed_users">Allowed users</label>
    <input id="allowed_users" name="allowed_users" type="text" class="form-input"
           value="{{ allowed_users }}">
    <span class="hint">Comma-separated Telegram user IDs</span>
  </div>

  <div class="form-group">
    <label class="form-label small-caps" for="bootstrap">Bootstrap</label>
    <select id="bootstrap" name="bootstrap" class="form-input">
      {{ select_options(bootstrap_options, tg_bootstrap) }}
    </select>
  </div>
</div>

<div class="config-card">
  <h3 class="config-section-label small-caps">Agent</h3>

  <div class="form-group">
    <label class="form-label small-caps" for="model">Model</label>
    <input id="model" name="model" type="text" class="form-input"
           value="{{ config.agent.model }}" required>
    <span class="hint">e.g. <code>anthropic/claude-sonnet-4-5-20250514</code></span>
  </div>
</div>

<div class="form-actions">
  <button class="btn btn-primary" type="submit">Save Changes</button>
</div>
</form>
