// Assets/_Project/Scripts/Gameplay/EnemyDefinition.cs
using UnityEngine;

namespace TD.Gameplay
{
    /// <summary>
    /// Data definition for a single enemy type. One asset per type; shared across all
    /// instances spawned in a match. Consumed by <see cref="WaveManager"/> at spawn time.
    /// </summary>
    /// <remarks>
    /// Follows the same ScriptableObject pattern as <c>TowerDefinition</c>: data lives
    /// in project assets, only the asset reference (or its fields) crosses runtime code.
    /// Replace <see cref="EnemyPrefab"/> with a real mesh/animator when art is ready —
    /// no code changes required.
    /// </remarks>
    [CreateAssetMenu(fileName = "EnemyDefinition", menuName = "TD/Enemy Definition", order = 3)]
    public class EnemyDefinition : ScriptableObject
    {
        [Header("Identity")]
        [Tooltip("Human-readable name shown in debug logs and future enemy-info UI.")]
        public string DisplayName;

        [Header("Stats")]
        [Tooltip("Maximum hit points for this enemy type.")]
        public float MaxHp = 100f;

        [Tooltip("Movement speed in world units per second along the A* path.")]
        public float MoveSpeed = 3f;

        [Tooltip("When true this enemy flies: it paths on the baked terrain grid, ignoring " +
                 "towers, so it soars directly over the maze instead of following it. " +
                 "Towers with GroundedOnly=true will not target it.")]
        public bool IsFlying;

        [Tooltip("Height (world units) above the ground a flying enemy hovers, so it " +
                 "visually clears towers. Only used when IsFlying is true. Keep modest — " +
                 "tower targeting uses 3D range, so large values eat into effective range.")]
        public float FlightHeight = 3f;

        [Header("Costs")]
        [Tooltip("Number of lives deducted from the shared pool when this enemy " +
                 "reaches the Goal. Boss enemies might cost 2 or more lives.")]
        public int LivesCost = 1;
        // GoldReward removed in favor of per-wave GoldPerEnemy in GoldConfig — every
        // enemy in a given wave grants the same kill reward regardless of type. If
        // per-type variation is needed later, add an optional override here.

        [Header("Visuals")]
        [Tooltip("Prefab spawned in the world for this enemy. Must have NetworkObject, " +
                 "NetworkTransform, EnemyHealth, EnemyStatus, and EnemyMovement at its root. " +
                 "Place it on the Enemy physics layer.")]
        public GameObject EnemyPrefab;
    }
}
