package models

import "time"

type User struct {
	ID           int        `json:"id"`
	Username     string     `json:"username"`
	PasswordHash string     `json:"-"`
	DisplayName  string     `json:"display_name"`
	Role         string     `json:"role"`
	TOTPEnabled  bool       `json:"totp_enabled"`
	TOTPSecret   string     `json:"-"`
	CreatedAt    time.Time  `json:"created_at"`
	LastLogin    *time.Time `json:"last_login,omitempty"`
}

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse struct {
	Token        string `json:"token,omitempty"`
	ExpiresAt    string `json:"expires_at,omitempty"`
	User         *User  `json:"user,omitempty"`
	TOTPRequired bool   `json:"totp_required,omitempty"`
	TOTPToken    string `json:"totp_token,omitempty"`
}

type TOTPValidateRequest struct {
	TOTPToken string `json:"totp_token"`
	Code      string `json:"code"`
}

type TOTPSetupResponse struct {
	Secret  string `json:"secret"`
	URI     string `json:"uri"`
}

type TOTPConfirmRequest struct {
	Code string `json:"code"`
}

type TOTPDisableRequest struct {
	Password string `json:"password"`
	Code     string `json:"code"`
}
