package types

// User struct represents a user in the system
type User struct {
	UserId   string `json:"userId"`
	Username string `json:"username"`
	Password string `json:"password"`
}

// If the user needs to be served over the api, we dont want to send the password
// ToPublicUser converts a User to a PublicUser
func (u *User) ToPublicUser() (*PublicUser, error) {
	return &PublicUser{
		UserId:   u.UserId,
		Username: u.Username,
	}, nil
}

// Should be used when registering, for example
type NewUser struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

// PublicUser represents a user that is safe to send over the API (no password)
type PublicUser struct {
	UserId   string `json:"userId"`
	Username string `json:"username"`
}

// wrapper type for token
type Token struct {
	Token string `json:"token"`
}

type StrNameChange struct {
	PrevName string `json:"prevName" db:"prevName"`
	NewName  string `json:"newName" db:"newName"`
}
