package types

import (
	"time"

	"gitea.local/admin/hspguard/internal/repository"
	"github.com/google/uuid"
)

type UserDTO struct {
	ID             uuid.UUID  `json:"id"`
	Email          string     `json:"email"`
	FullName       string     `json:"full_name"`
	IsAdmin        bool       `json:"is_admin"`
	CreatedAt      *time.Time `json:"created_at"`
	UpdatedAt      *time.Time `json:"updated_at"`
	LastLogin      *time.Time `json:"last_login"`
	PhoneNumber    *string    `json:"phone_number"`
	ProfilePicture *string    `json:"profile_picture"`
	EmailVerified  bool       `json:"email_verified"`
	AvatarVerified bool       `json:"avatar_verified"`
	Verified       bool       `json:"verified"`
}

func NewUserDTO(row *repository.User) UserDTO {
	return UserDTO{
		ID:             row.ID,
		Email:          row.Email,
		FullName:       row.FullName,
		IsAdmin:        row.IsAdmin,
		CreatedAt:      row.CreatedAt,
		UpdatedAt:      row.UpdatedAt,
		LastLogin:      row.LastLogin,
		PhoneNumber:    row.PhoneNumber,
		ProfilePicture: row.ProfilePicture,
		EmailVerified:  row.EmailVerified,
		AvatarVerified: row.AvatarVerified,
		Verified:       row.Verified,
	}
}
