// Login page. Route: /login. Uses the centered `auth` layout.
// The form declares data-schema="login" — the framework injects the schema
// descriptor + the generic validator, which validates on submit/blur and writes
// messages into the [data-error] spans. The same schema guards POST /api/login.
page Login {
  layout = "auth"

  seo {
    title = "Sign in"
  }

  view {
    <form data-schema="login" method="post" action="/api/login" data-redirect="/dashboard">
      <div data-component="stack" gap="4">
        <h1>Sign in</h1>

        <div class="wire-alert wire-alert--success" data-success="Signed in! The form posted JSON and was validated server-side." hidden></div>

        <div>
          <div data-component="input" type="email" name="email" placeholder="you@example.com"></div>
          <span class="wire-field-error" data-error="email"></span>
        </div>

        <div>
          <div data-component="input" type="password" name="password" placeholder="Password"></div>
          <span class="wire-field-error" data-error="password"></span>
        </div>

        <button type="submit" class="wire-btn wire-btn--primary wire-btn--lg">Sign in</button>
        <p><a href="/">Back home</a></p>
      </div>
    </form>
  }
}
