package types

import (
	"time"

	pb "gitea.boner.be/bdnugget/goonserver/actions"
	rl "github.com/gen2brain/raylib-go/raylib"
)

type Tile struct {
	X, Y     int
	Height   float32
	Walkable bool
}

type AnimationSet struct {
	Idle []rl.ModelAnimation
	Walk []rl.ModelAnimation
	// Can add more animation types later like:
	// Attack []ModelAnimation
	// Jump   []ModelAnimation
}

type ModelAsset struct {
	Model            rl.Model
	Texture          rl.Texture2D
	Animation        []rl.ModelAnimation // Keep this for compatibility
	AnimFrames       int32               // Keep this for compatibility
	Animations       AnimationSet        // New field for organized animations
	YOffset          float32             // Additional height offset (added to default 8.0)
	PlaceholderColor rl.Color
}

type ChatMessage struct {
	PlayerID int32
	Username string
	Content  string
	Time     time.Time
}

type FloatingMessage struct {
	Content    string
	ExpireTime time.Time
	ScreenPos  rl.Vector2 // Store the screen position for 2D rendering
}

type ChatMessageHandler interface {
	HandleServerMessages([]*pb.ChatMessage)
}

const (
	MapWidth   = 50
	MapHeight  = 50
	TileSize   = 32
	TileHeight = 2.0

	// RuneScape-style tick rate (600ms)
	ServerTickRate = 600 * time.Millisecond
	ClientTickRate = 50 * time.Millisecond
	MaxTickDesync  = 5
)

// UI constants
const (
	ChatMargin      = 10
	ChatHeight      = 200
	MessageHeight   = 20
	InputHeight     = 30
	MaxChatMessages = 50
)
