package models

import (
	"time"

	"github.com/google/uuid"
)

type Client struct {
	ID        uuid.UUID  `json:"id" db:"id"`
	Name      string     `json:"name" db:"name"`
	Email     string     `json:"email" db:"email"`
	Phone     string     `json:"phone" db:"phone"`
	Address   string     `json:"address" db:"address"`
	Username  string     `json:"username" db:"username"`
	Password  string     `json:"-" db:"password"` // Never return password in JSON
	Status    string     `json:"status" db:"status"`
	IsActive  bool       `json:"is_active" db:"is_active"`
	LastLogin *time.Time `json:"last_login" db:"last_login"`
	CreatedAt time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
}

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

// LoginUserInfo represents user information returned in login response
type LoginUserInfo struct {
	FirstName *string `json:"first_name"`
	LastName  *string `json:"last_name"`
	Email     *string `json:"email"`
	Phone     *string `json:"phone"`
	Username  *string `json:"username"`
	Role      *string `json:"role"`
	Status    string  `json:"status"`
	AvatarURL *string `json:"avatar_url"`
}

type LoginResponse struct {
	Message string        `json:"message"`
	Token   string        `json:"token"`
	User    LoginUserInfo `json:"user"`
}

type ClientInfo struct {
	ID       uuid.UUID `json:"id"`
	Name     string    `json:"name"`
	Email    string    `json:"email"`
	Username string    `json:"username"`
	Status   string    `json:"status"`
	IsActive bool      `json:"is_active"`
}

// Forgot Password Models
type ForgotPasswordRequest struct {
	Email string `json:"email" validate:"required,email"`
}

type ForgotPasswordResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

type VerifyOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
	OTP   string `json:"otp" validate:"required,len=6"`
}

type VerifyOTPResponse struct {
	Message    string `json:"message"`
	ResetToken string `json:"reset_token"`
	Success    bool   `json:"success"`
}

type ResetPasswordRequest struct {
	ResetToken string `json:"reset_token" validate:"required"`
	Password   string `json:"password" validate:"required,min=6"`
}

type ResetPasswordResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

