package model

import (
	"time"

	"github.com/google/uuid"
)

type Role string

const (
	RoleAdmin Role = " admin"
	RoleUser  Role = "user"
	RoleGuest Role = "guest"
)

// InvalidJWT Represents a JWT that has expired or is otherwise invalid.
type InvalidJWT struct {
	JWT        string `gorm:"primarykey"`
	ValidUntil time.Time
}

// User represents a user with an ID, UUID, name, role, and password.
type User struct {
	ID       uint      `gorm:"primarykey" json:"-"`
	UUID     uuid.UUID `gorm:"type:uuid" json:"uuid"`
	Name     string    `json:"name" gorm:"unique"`
	Role     Role      `json:"role"`
	Password []byte    `json:"-"`
}

// NewUser creates a new User struct with a generated UUID.
func NewUser() User {
	return User{
		UUID: uuid.New(),
	}
}
