class_name Enums
extends RefCounted

## Card Elements
enum Element {
	FIRE,
	ICE,
	WIND,
	LIGHTNING,
	WATER,
	EARTH,
	LIGHT,
	DARK
}

## Card Types
enum CardType {
	FORWARD,
	BACKUP,
	SUMMON,
	MONSTER
}

## Ability Types
enum AbilityType {
	FIELD,
	AUTO,
	ACTION,
	SPECIAL
}

## Game Phases
enum TurnPhase {
	ACTIVE,
	DRAW,
	MAIN_1,
	ATTACK,
	MAIN_2,
	END
}

## Attack Phase Steps
enum AttackStep {
	PREPARATION,
	DECLARATION,
	BLOCK_DECLARATION,
	DAMAGE_RESOLUTION
}

## Zone Types
enum ZoneType {
	DECK,
	HAND,
	FIELD_FORWARDS,
	FIELD_BACKUPS,
	DAMAGE,
	BREAK,
	STACK,
	REMOVED
}

## Card States
enum CardState {
	ACTIVE,
	DULL
}

## Helper functions for Element
static func element_from_string(s: String) -> Element:
	match s.to_lower():
		"fire": return Element.FIRE
		"ice": return Element.ICE
		"wind": return Element.WIND
		"lightning": return Element.LIGHTNING
		"water": return Element.WATER
		"earth": return Element.EARTH
		"light": return Element.LIGHT
		"dark": return Element.DARK
	push_error("Unknown element: " + s)
	return Element.FIRE

static func element_to_string(e: Element) -> String:
	match e:
		Element.FIRE: return "Fire"
		Element.ICE: return "Ice"
		Element.WIND: return "Wind"
		Element.LIGHTNING: return "Lightning"
		Element.WATER: return "Water"
		Element.EARTH: return "Earth"
		Element.LIGHT: return "Light"
		Element.DARK: return "Dark"
	return "Unknown"

static func element_to_color(e: Element) -> Color:
	match e:
		Element.FIRE: return Color(0.9, 0.2, 0.2)      # Red
		Element.ICE: return Color(0.4, 0.8, 0.9)       # Cyan
		Element.WIND: return Color(0.3, 0.8, 0.3)      # Green
		Element.LIGHTNING: return Color(0.6, 0.3, 0.8) # Purple
		Element.WATER: return Color(0.2, 0.4, 0.9)     # Blue
		Element.EARTH: return Color(0.8, 0.7, 0.3)     # Yellow
		Element.LIGHT: return Color(1.0, 1.0, 0.9)     # White
		Element.DARK: return Color(0.2, 0.1, 0.3)      # Dark Purple
	return Color.WHITE

## Helper functions for CardType
static func card_type_from_string(s: String) -> CardType:
	match s.to_lower():
		"forward": return CardType.FORWARD
		"backup": return CardType.BACKUP
		"summon": return CardType.SUMMON
		"monster": return CardType.MONSTER
	push_error("Unknown card type: " + s)
	return CardType.FORWARD

static func card_type_to_string(t: CardType) -> String:
	match t:
		CardType.FORWARD: return "Forward"
		CardType.BACKUP: return "Backup"
		CardType.SUMMON: return "Summon"
		CardType.MONSTER: return "Monster"
	return "Unknown"

## Helper functions for TurnPhase
static func phase_to_string(p: TurnPhase) -> String:
	match p:
		TurnPhase.ACTIVE: return "Active Phase"
		TurnPhase.DRAW: return "Draw Phase"
		TurnPhase.MAIN_1: return "Main Phase 1"
		TurnPhase.ATTACK: return "Attack Phase"
		TurnPhase.MAIN_2: return "Main Phase 2"
		TurnPhase.END: return "End Phase"
	return "Unknown Phase"

## Check if element is Light or Dark (special rules apply)
static func is_light_or_dark(e: Element) -> bool:
	return e == Element.LIGHT or e == Element.DARK

## Alias for element_to_color
static func get_element_color(e: Element) -> Color:
	return element_to_color(e)
