"""Authentication endpoints."""

from fastapi import APIRouter, HTTPException
from pydantic import BaseModel

router = APIRouter(prefix="/api/auth", tags=["Auth"])


class LoginRequest(BaseModel):
    username: str
    password: str


class LoginResponse(BaseModel):
    token: str
    username: str


@router.post("/login", response_model=LoginResponse)
def login(payload: LoginRequest) -> dict:
    """Simple login for development."""
    if payload.username == "admin" and payload.password == "123456":
        return {"token": "fake-jwt-token-for-admin", "username": payload.username}
    raise HTTPException(status_code=401, detail="Invalid credentials")
